Let's say I have 4 classes:
class I { public: virtual void X() = 0; }; class A : public virtual I { public: virtual void X() { } }; class B : public I { }; class C : public A, public B { };
I , B and C are abstract, where as A is not. If I just add virtual to the I inheritance for B , then A::X() resolves I::X() to C
However, I cannot change the source of B
My question is . Can I get A::X() to solve I::X for C without being able to change B ? I tried declaring A and B virtual for C no avail. I try not to have redundant code (for example, C declare X () {A :: X ();}). Any neat hacks?
In addition, there are a few questions very similar to this, but I could not find any talk about using virtual inheritance. Please point me if I missed this.
source share