Define a class overload that contains the following member functions
i) Reverse(int n) - reverses the number n and returns the reversed number.
ii) Reverse(int a, int b) - interchanges the values of a and b.
iii) Reverse(int m, int n, int x ) - display the number from n to m in reverse order, decreasing by x.
Answers
Answered by
0
Explanation:
Overloading occurs when multiple methods have same signature and return type but different number/datatypes of parameters.
In (i) you are returing a single integer
nut in (ii) you are trying to return 2 intergers i.e. return type is not same as previos method
in (iii) the return type is different
Therefore it will give a Compile time error .
Overloading should have same return type.
Similar questions