How is this even allowed to compile and run?
Since BaseA and BaseB have pure virtual functions, each should be overridden in Derived in order to be able to instantiate the class. Does this mean that the foo() override implements both?
Is there any way to implement each virtual function differently and call them explicitly?
struct BaseA { virtual void foo() = 0; };
struct BaseB { virtual void foo() = 0; };
struct Derived : public BaseA, public BaseB
{
void foo() override {}
};
int main()
{
Derived a;
a.foo();
return 0;
}