The word polymorphism means having many forms. Typically, polymorphism occurs when there is a hierarchy of classes and they are related by inheritance.

C++ polymorphism means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function.

Consider the following example where a base class has been derived by other two classes:

polymorphism is divided into two parts.

(1)Static Binding  (Early Binding)

  • Constructor Overloading
  • Function Overloading
  • Operator Overloading

(2)Dynamic Binding  (late Binding)

Example of Polymorphism:  (operator Overloading)



class A


    int a;




    void operator +(A a2)
        cout<<" value ="<<a+a2.a;
    void operator *(A a1)
        cout<<" New value="<<a*a2.a;
    int operator -(A a1)
        cout<<" New value="<<a-a2.a;
    void operator /(A a1)
        cout<<" New value="<<a/a2.a;
void main()
    int ans=a1-a2;