Panks said:
I thought to remind you of post anyways. There is no foul play in
original post a gave you strict statement from a books that
overloading on return type is not supported.
Ok if now if i am able to compile the code and run it hence compiler
accepts this overloaded definition. No matter i have overloaded it on
parameters also. You can add code to accept the return values it runs
even that also error free.
Point is why is the contradiction? Rather looking for header file
stement i hope you focus on core issue.
I can barely understand what your point is. Let me explain what is
meant by "overloading on return value". If we remove all other function
signature differences (name, number and types of arguments), all that
remains is the return value type. Now, given that two functions *only*
differ in the return value type, is it allowed? If it were allowed, the
following would be legal code:
int foo();
double foo();
int main() {
return foo();
}
and the function 'foo' chosen in the 'main' function would be the one
that retuns an int. Now, since it _isn't_ allowed, the compiler will
refuse to compile this code.
In your example functions had different number and types of arguments.
And that's how the compiler knows which function to use. Return value
types play _no_role_ there. You can make them all the same, you can
make them different, it *does not matter*.
V