overloading methods

HI,
why the compiler consdier the arguments of method while calling overloaded function and not function return type.

thanks in advance............
Overloaded functions are recognized by the different arguments they have
eg:
Right Overload:
1
2
int f( int );
int f( double );

Wrong Overload:
1
2
int f( int );
double f( int );//same arguments, the compiler wouldn't know which to call 

http://www.cplusplus.com/doc/tutorial/functions2.html#function_overload
He's asking why that is the case, not for the fact that it is.

I think it is just that determining which to call is a good bit more difficult if the return type were considered than just the argument lists.

Hope this helps.
Topic archived. No new replies allowed.