What Is Function Overloading In C++ With Example

What Is Function Overloading In C++ With Example

What Is Function Overloading In C++ With Example



What Is Function Overloading In C++ With Example




What Is Function Overloading In C++ With Example


     Some function name with different argument is called function overloading.

#include<iostream.h>
#include<conio.h>
class arun
{
public:
void sum(int a)
{
cout<<"The value of a is:"<<a<<endl;
}
void sum(int a,int b)
{
cout<<"The value of a+b is:"<<a+b<<endl;
}
void sum(int a,int b,int c)
{
cout<<"The value of a+b+c is:"<<a+b+c<<endl;
}
};
void main()
{
arun a;
clrscr();
a.sum(10);
a.sum(10,20);
a.sum(10,20,30);
getch();

}

Post a Comment

0 Comments