With the C++ language, you can overload functions and operators. Overloading is the practice of supplying more than one definition for a given function name in the same scope. The compiler is left to pick the appropriate version of the function or operator based on the arguments with which it is called. For example:
The function max is considered an overloaded function. It can be used in code such as the following:
int i = max( 12, 8 );
double d = max( 32.9, 17.4 );
In the first case, where the maximum value of two variables of type int is being requested, the function max( int, int ) is called. However, in the second case, the arguments are of type double, so the function max( double, double ) is called.
You have viewed 1 page out of 62. Your C++ learning is 0.00% complete. Login to check your learning progress.