NOTE : -
THIS CONTENT IS NOT ORIGINAL
13. FUNCTION OVERLOAD: several functions can be declared with the same name provided there is a difference in their parameter list
One important advantage of C++ is the OPERATOR OVERLOAD. Different functions can have the same name provided something allows the compiler to distinguish between them: number of parameters, type of parameters...
One important advantage of C++ is the OPERATOR OVERLOAD. Different functions can have the same name provided something allows the compiler to distinguish between them: number of parameters, type of parameters...
using namespace std;
#include
double test (double a, double b)
{
return a + b;
}
int test (int a, int b)
{
return a - b;
}
int main ()
{
double m = 7, n = 4;
int k = 5, p = 3;
cout << test(m, n) << " , " << test(k, p) << endl;
return 0;
}
| Output |
| 11 , 2 |
BIBILOGRAPHY / REFERENCE : - http://www.4p8.com/eric.brasseur/cppcen.html

No comments:
Post a Comment