Member function overloading
For Example: Write a
program demonstrate the use member function overloading.
#include<iostream.h>
#include<conio.h>
void sunfun(int a, int b) //Function declaration and definition in a single section
{
cout<<"Addition
of Two Integer Number = "<<(a + b)<<endl;
}
void sunfun(double a,
double b) //again sunfun() is defined
{
cout<<"Addition
of Two Double Number = "<<(a + b);
}
int main()
{
sunfun(22,13); //function calling
sunfun(9.2,7.4); //function calling
getch();
return 0;
}
Comments
Post a Comment