

location pointed to by pointer) and Early binding(Compile time) is done according to the type of pointer, since print() function is declared with virtual keyword so it will be bound at run-time (output is print derived class as pointer is pointing to object of derived class ) and show() is non-virtual so it will be bound during compile time(output is show base class as pointer is of base type ). Late binding(Runtime) is done in accordance with the content of pointer (i.e. In above code, base class pointer ‘bptr’ contains the address of object ‘d’ of derived class. Also, a base class pointer can point to the objects of base class as well as to the objects of derived class.


