C++ Function Overloading


It refers to the use of the same thing for different purposes. C++ also permits the overloading of functions. It means that we can use the same function name to create functions that perform a variety of different tasks.

Function Overloading in C++:

In Function Overloading, we can design a family of functions with one function name but with different argument lists. The function would perform different operations depending on the argument list in the function call.


int area(int);
int area(int, int);
float area(float);
int main()
cout<<"The area of Square:"<<area(12)<<"\n";
cout<<"The area of Rectangle:"<<area(12,15)<<"\n";
cout<<"The area of Circle:"<<area(7)<<"\n";
return 0;
int area(int s)
int area(int l, int b)
float area(float r)

The area of Square: 144
The area of Rectangle: 180
The area of Circle: 153.86