There is a class FooBase which has a method FunBase (). From this class, two classes, FooA and FooB, are inherited through virtual inheritance. In FooB, the FunBase () method is removed, because it cannot be there according to the logic of the program. From these two classes, the class FooEnd is inherited in which the FunBase () method should be. How to change the code so that the FooEnd object would be possible to call the FunBase () method without using aggregation.
using std::cout; using std::endl; class FooBase { public: void FunBase() { cout << "FunBase" << endl; } }; class FooA: virtual public FooBase { public: void FunA() { cout << "FunA" << endl; } }; class FooB: virtual public FooBase { public: void FunB() { cout << "FunB" << endl; } void FunBase() = delete; }; class FooEnd: public FooA, public FooB { public: void FunEnd() { cout << "FunEnd" << endl; } }; int main() { FooEnd bat; bat.FunBase(); return 0; } By aggregation, I mean a record of the form:
class FooEnd: public FooA, public FooB { public: void FunEnd() { cout << "FunEnd" << endl; } void FunBase() { FooBase::FunBase(); }; };