I have three different base classes:
class BaseA
{
public:
virtual int foo() = 0;
};
class BaseB
{
public:
virtual int foo() { return 42; }
};
clas
In the derived class a method is virtual if it is defined virtual in the base class, even if the keyword virtual is not used in the derived class's method.
BaseA, it will compile and execute as intended, with foo() being virtual and executing in class Child.BaseB, it will also compile and execute as intended, with foo() being virtual() and executing in class Child.BaseC however, it will compile and execute, but it will execute the BaseC version if you call it from the context of BaseC, and the Child version if you call with the context of Child.