Compiler Error C2387
'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();
}
Athugasemdir
https://aka.ms/ContentUserFeedback.
Væntanlegt: Á árinu 2024 munum við hætta með GitHub-mál sem ábendingaleið fyrir efni og skipta því út fyrir nýtt ábendingakerfi. Frekari upplýsingar er að finna hér:Senda inn og skoða endurgjöf fyrir