In this case, classes A and C are interfaces, and E implements two interfaces. (Typically, you would not have intermediate classes C and D in this case.) There are several ways to deal with this.
The most common is probably the definition of a new interface, which is the sum of A and C :
class AandC : public A, public C {};
and have E Then you usually control E through AandC* , passing it evenly to functions that take A* or C* . Functions that need both interfaces in the same object will be with AandC* .
If the interfaces A and C are somehow connected, say, C offers additional tools that some A (but not all) may want support, then for A might make sense to have a getB() function that returns C* (or a null pointer if object does not support interface C ).
Finally, if you have mixins and several interfaces, the cleanest solution is to support two independent hierarchies, one for the interfaces and the other with implementation parts:
// Interface... class AandC : public virtual A, public virtual C {}; class B : public virtual A { // implement A... }; class D : public virtual C { // implement C... }; class E : public AandC, private B, private D { // may not need any additional implementation! };
(I am tempted to say that from a design point of view, the inheritance of an interface should always be virtual in order to allow such a thing into the future, even if it is not needed now. In practice, however, it seems rather rare that there is no way to predict this in advance using.)
If you need more information about this, you might want to read Barton and Nakman. Now the book is quite dated (it describes pre C ++ 98), but most of the information remains valid.