Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'type' : ambiguous base class
The compiler could not unambiguously resolve a function call because the function exists in more than one base class.
To resolve this error, either remove one of the base classes from the inheritance, or explicitly qualify the function call.
The following sample generates C2387:
// C2387.cpp
namespace N1 {
struct B {
virtual void f() {
}
};
}
namespace N2 {
struct B {
virtual void f() {
}
};
}
struct D : N1::B, N2::B {
virtual void f() {
B::f(); // C2387
// try the following line instead
// N1::B::f();
}
};
int main() {
D aD;
aD.f();
}