Polymorphism

Polymorphism means a message or data to be processesed in more than one form.
Here ploy means"Many" and morphos means "Forms". Polymorphism can be defined  as the ability to use the same name for two or more related but technically different tasks.


#include<iostream.h>
#include<conio.h>
class abc
{
public:
void sum (int a,int b)   //function with two arguments
{
int c;
c=a+b;
cout<<c;
}
};
class xyz:public abc //class xyz inherits abc
{
public:
void sum (double a,double b)// again function sum with two arguments
{
double c;
c=a+b;
cout<<c;
}
};
 int main()
{
xyz ob1;  //ob1 is the object of class xyz
clrscr();
ob1.sum(2,3);//function calling
ob1.sum(2.4,4.2);
getch();
return 0;
}

Polymorphism
Explaination:
In above example abc is the parent class and xyz is the child class which inherits abc class.
This means in child class there are two sum function but  both are different . The main difference
is the arguments . Arguments are different means in parents class the arguments are of integer type
and in child class the arguments are of double type.