Okay so you are saying that you have:
B
+
|
v
A
+
+----+----+
v v
C D
And all of these are non-virtual inheritance and then you have class E
that virtualy inherits B
and C
also inherits it so a complete diagram would be:
+-----------+B
| +
| |
v v
E A
+ +
+---+---+----+----+
v v
C D
With the exception that B
is virtualy inherited by E
.
The solution is simple you should make A
also virtually inherit B
, however I gathered from your question that you can not modify A
. Your next option is to make C
inherit A
or E
and have an instance of the other this is called delegation.
An alternative you can provide a common interface and allow polymorphism you might want to make an interface (pure virtual class) that has all the function in E
that C
uses and then make C
and E
derive that interface. E
would implement the virtual functions from the interface and C would implement it as function calls to E
's implementation. Alternatively (not recommended) you can live with the diamond of death if it is not problematic for you, however determining that is tricky and I don't recommend this it's a terrible idea.