POLYMORPHISM

-> It is the ability for a message or data to be processed in more than one form.

-> It is the property by which same message can be sent to objects of several different classes.

Example:

A same function AREA ( ) is being used to calculate the area of different shapes :

#include <iostream.h>


class SHAPE {

   public:
void AREA(int l)    // Function Definition to calculate area of Square
{
cout << "Area of Square is : " << l*l << endl;
}

void AREA (int l,int b) //Function Definition to calculate area of rectangle
{
cout << "Area of Rectangle is : " << l*b << endl;
}



};

void main( )
{

      SHAPE s;
s.AREA (10); // Function call to calculate area of Square
s.AREA(5,10); //Function call to calculate area of Rectangle


}