Saved Bookmarks
| 1. |
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. |
| Answer» TION:Overloading occurs when MULTIPLE METHODS have same signature and RETURN type but different number/datatypes of parameters.In (i) you are returing a single integernut 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. | |