Ambiguous when two superclasses have a member function with the same name, but different signatures
问题 struct A { void f(int x) {} }; struct B { template<typename T> void f(T x) {} }; struct C : public A, public B {}; struct D { void f(int x){} template<typename T> void f(T x) {} }; int main(int argc, char **argv) { C c; c.f<int>(3); D d; d.f<int>(3); } What is the reason for which calling d.f is fine, but c.f gives error: request for member ‘f’ is ambiguous error: candidates are: template<class T> void B::f(T) error: void A::f(int) 回答1: The first part is due to member name lookup, that's why