Suppose I have a diamond inheritance situation as follows:
class A{ public: virtual void foo(){}; }; class B: public virtual A{ public: virtual void foo(){}; }; class C: public virtual A{ public: virtual void foo(){}; }; class D: B, C{};
The last line gives a compilation error, citing ambiguity. As far as I understand, the problem is that the compiler does not know which foo to put vtbl in D, but why not even be vtbl for D if it does not define any native virtual functions?
c ++ multiple-inheritance vtable
Epsilonvector
source share