Victor Bazarov
10/29/2008 1:06:00 PM
zbigniew@szymczyk.eu wrote:
> Can someone explain me how overload resolution works in C++?
>
> For example if I have function void f(char, int); and I will call
> f('A', 3.1) or f(1.5, 3.1F) what would be the result?
If you only have a single function called 'f', no overload is present.
Overload is only there if you have more than one function named 'f':
void f(char, int);
void f(long, double);
int main() {
f(0L, 0.0); // the latter is called
f('c', 42); // the former is called
}
Explaining how overload resolution "works" can take weeks. Please find
a decent C++ book and read the section/chapter on overloading.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask