I am learning templates and stuck with the following case:
class ClassA {
LPCWSTR Name(void) {...};
UINT Name(LPCWSTR name) {...};
LPCWSTR Surname(void) {...};
UINT Surname(LPCWSTR name) {...};
}
class ClassB {
template <class T>
bool SetValue(UINT(T::*Setter)(LPCWSTR), T& object, LPCWSTR value) {
(object.*Setter)(value)
}
}
class ClassC : ClassB {
SomeMethod() {
ClassA a;
// Compiler says it can't determine what overloaded instance to choose here.
SetValue(&ClassA::Name, a, "Mike");
}
}
How can I pass the right address of the method?