A
Aguilar, James
I want to know how C++ selects the correct function when there are two
functions of the same name which might be selected.
Here is an example.
class Foo
{
public:
void fooBar(); //(m1)
void fooBar(int); //(m2)
}
int main()
{
void (*ptrToMeth)(int) = Foo::fooBar; //(1)
void (*ptrToMeth2)() = Foo::fooBar; //(2)
return 0;
}
I know that the pointer to fooBar is resolved based on its name. However,
how do the assignments (1) and (2) know that they are supposed to point to
(m2) and (m1) respectively?
Thanks for the help in advance.
functions of the same name which might be selected.
Here is an example.
class Foo
{
public:
void fooBar(); //(m1)
void fooBar(int); //(m2)
}
int main()
{
void (*ptrToMeth)(int) = Foo::fooBar; //(1)
void (*ptrToMeth2)() = Foo::fooBar; //(2)
return 0;
}
I know that the pointer to fooBar is resolved based on its name. However,
how do the assignments (1) and (2) know that they are supposed to point to
(m2) and (m1) respectively?
Thanks for the help in advance.