PRB: C2250 Error Generated with Ambiguous Multiple Inheritance (104186)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++ for Windows, 16-bit edition 1.51
- Microsoft Visual C++ for Windows, 16-bit edition 1.52
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q104186 SYMPTOMS
With the Microsoft C/C++ compiler, the error
Error C2250: 'identifier': Ambiguous Inheritance of 'class::member'
may be generated when a class inherits from two or more classes, at least
two of which derive from the same virtual base class and redefine the same
base class virtual member.
CAUSE
This is expected C++ compiler behavior.
In the Sample Code below, the error is generated because D::f is ambiguous.
That is, both class B and class C redefine their member f(), inherited from
the virtual base class A, and class D inherits from B and C. As class D
has only one vtable slot for the virtual function f(), and both B::f and
C::f cannot be put there, the compiler generates error C2550.
RESOLUTION
There are two ways to avoid the error:
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbCompiler kbCPPonly kbprb KB104186 kbAudDeveloper |
---|
|