You set up some kind of connection between Base1 and Base2 so that both of them cannot be received.
You can make them both from Base0, and in this case, if you get Base1 and Base2, you will get a multiple inheritance diamond in order to get a compiler error, assuming that you are not using virtual inheritance and you are not allowing duplication.
This may solve your problem, but I doubt why you are trying to do it.
(Base0 should not be a completely empty class, as there must be something ambiguous there to make the compiler complain. And, of course, you could decide that it doesnโt completely stop you from extracting what it will generate from them required compiler error if you do this by mistake).
An example could be:
class Base0 { protected: virtual ~Base0(){}; virtual void abstractMethod() const = 0; }; class Base1 : public Base0 { protected: virtual void abstractMethod() const;
Cashcow
source share