Sudeep Kumar Das

Does overloading depends on return type?


Explanation

1136    0

Function overloading is possible in C++ and Java but only if the functions must differ from each other by the types and the number of arguments in the argument list. However, functions can not be overloaded if they differ only in the return type. 

The return type of a function has no effect on function overloading, therefore the same function signature with different return type will not be overloaded.

Example: if there are two functions: int sum() and float sum(), these two will generate a compile-time error as function overloading is not possible here.



Share:   

More Questions from Module 0