C++ Programming & Tutorials for Beginners

Polymorphism

Home  »  C++ Programming  »  Polymorphism


     Base class member functions can be overridden by defining a derived class member function with the same name as that of the base class member fuction. This concept is know as polymorphism. The concept of polymorphism is very much dependent on the late binding of functions technique. In other words, polymorphism is implemented using virtual functions.

The word 'poly' is a Greek word meaning many and 'morphism' means forms. Thus polymorphism means many forms. Polymorphism is a process of defining a number of objects of different classes into a group and call the member functions is a process to carry out the operation of the objects using different function class. Virtual functions perform a vital role in implementation of polymorphism. The keyword virtual is used to perform the polymorphism. The keyword virtual tells the compiler which function to choose during the execution of the program. So, we can define polymorphism as the late/run time binding of member functions of the class using virtual functions. the pointers are used in the concept for passing the address of derived class object and access its functions. Therefore, polymorphism refers to the run time binding to a pointer to a method/member function. Actually polymorphism is nothing but late binding of member functions.

To demonstrate the concept of polymorphism applied to the member function.








Previous
Next Post »