Overloading on Return values

In C++ can the functions be overloaded only on return values.

solution:

No, the compiler will flag an error, even if they are simply declared.
For ex:

int Foo();
bool Foo();
int main()
{
}

will generate,

overload.cpp:2: error: new declaration ‘bool Foo()’
overload.cpp:1: error: ambiguates old declaration ‘int Foo()’

No comments: