C++ PROGRAM FOR ILLUSTRATING POLYMORPHISM.

#include<iostream.h>
#include<conio.h>
void sum(int,int,int);
void sum(int,int);
void main()
{
    int a,b,c,d;
    cout<<"Enter the values of a,b,c,d";
    cin>>a>>b>>c>>d;
    sum(a,b,c);
    sum(d,c);
    getch();
}
void sum(int a,int b,int c)
{
    int s;
    s=a+b+c;
    cout<<"Sum="<<s;

}
void sum(int a,int b)
{
    int s;
    s=a+b;
    cout<<"sum="<<sum;
}

Comments

Popular Posts