They must all be virtual
. From C++11 10.1 [class.mi]/7:
A class can have both virtual and non-virtual base classes of a given type.
class B { /* ... */ };
class X : virtual public B { /* ... */ };
class Y : virtual public B { /* ... */ };
class Z : public B { /* ... */ };
class AA : public X, public Y, public Z { /* ... */ };
For an object of class AA
, all virtual occurrences of base class B
in the class lattice of AA
correspond to a single B
subobject within the object of type AA
, and every other occurrence of a (non-virtual) base class B
in the class lattice of AA
corresponds one-to-one with a distinct B
subobject within the object of type AA
. Given the class AA
defined above, class AA
has two subobjects of class B
: Z
’s B
and the virtual B
shared by X
and Y
, as shown below.