Coupon Accepted Successfully!


Overloading Member Functions

Member functions are also overloaded in the same fashion as other ordinary functions. We learned that overloading is nothing but a function is defined with multiple definitions with same function name in the same scope. The following program explains the overloaded member function.

8.37 Write a program to overload member function of a class.

Explanation: In the above program, the class absv has a member function num(). The num() function is overloaded for integer and double. In function main() the object n invokes the member function num() with one value. The compiler invokes the overloaded function according to the value. The function returns the absolute value of the number.

Test Your Skills Now!
Take a Quiz now
Reviewer Name