Saturday, 23 June 2012

Why it's not possible to overload function by the return type?

Because functions can be called without assigning their return value to some variable. If we have

int foo();

and

double foo();

and call it just like

foo();

compiler won't know which overload to call.

No comments:

Post a Comment