class Parent
{
public:
void no();
virtualvoid yes();
};
class Child : public Parent
{
public:
void no();
virtualvoid yes();
};
int main()
{
Child obj;
Parent* p = &obj; // 'p' is a 'Parent' pointer, but it "actually" points to a 'Child'
p->no(); // non-virtual function. Calls Parent::no because 'p' "appears" to be
// a 'Parent' (because it's a Parent pointer)
p->yes(); // virtual funcion. Calls Child::yes because 'p' "actually" points to a 'Child'
// even though it's a Parent pointer
}
Such a method leaves no option other than to begin an ultimate
ancestor, ultra abstract, A Prior with a long list of methods,
each of one them without a purpose except for a form of the verb as
its name. There may be parameters as well.
I never heard of anyone speaking of calling parent's virtual method
from a child.
If you ever stumble on at least one virtual expression then
beware of the unexpected because such a class is under construction,
though virtual may point to no operation at all unlike pure virtual
function pointer.
Was any of the above sufficient?
Um, no? virtual is required to be defined just as much as a pure virtual one, the only difference is that non-pure virtual means the base class has a definition that can be used.