Udostępnij za pomocą


Błąd kompilatora C2584

"Klasa": bezpośrednia baza "Base2" jest niedostępna; baza "Base1"

Uwagi

Class już pochodzi bezpośrednio z Base1elementu . Base2również pochodzi z .Base1 Class nie może pochodzić z Base2 tego powodu, że oznaczałoby to dziedziczenie (pośrednio) z Base1 ponownego, co nie jest legalne, ponieważ Base1 jest już bezpośrednią klasą bazową.

Przykład

Poniższy przykład generuje kod 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();
};