description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||
---|---|---|---|---|---|---|---|
Learn more about: Compiler Error C2584 | Compiler Error C2584 | 11/04/2016 |
|
| 836e2c0a-86c0-4742-b432-beb0191ad20e |
'Class' : direct base 'Base2' is inaccessible; already a base of 'Base1'
Class
already derives directly from Base1
. Base2
also derives from Base1
. Class
cannot derive from Base2
because that would mean inheriting (indirectly) from Base1
again, which is not legal because Base1
is already a direct base class.
The following sample generates C2584.
// C2584.cpp// compile with: /cstructA1 { virtualintMyFunction(); }; structA2 { virtualintMyFunction(); }; structB1: publicvirtual A1, virtual A2 { virtualintMyFunction(); }; structB2: publicvirtual A2, virtual A1 { virtualintMyFunction(); }; structC: virtual B1, B2 { virtualintMyFunction(); }; structZ : virtual B2, virtual C { // C2584// try the following line insted// struct Z : virtual C {virtualintMyFunction(); };