Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C2584

Error Message

'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.

Example

The following sample generates C2584.

// C2584.cpp
// compile with: /c
struct A1 {
   virtual int MyFunction();
};

struct A2 {
    virtual int MyFunction();
};

struct B1: public virtual A1, virtual A2 {
    virtual int MyFunction();
};

struct B2: public virtual A2, virtual A1 {
    virtual int MyFunction();
};

struct C: virtual B1, B2 {
    virtual int MyFunction();
};

struct Z : virtual B2, virtual C {   // C2584
// try the following line insted
// struct Z : virtual C {
    virtual int MyFunction();
};

Community Additions

ADD
Show:
© 2015 Microsoft