nThe simple syntactic change of adding the virtual keyword to the declaration of statement has significantly changed the output.
nIn this example, the
member function statement is a virtual
function. It is defined in the base class and is overridden in the derived classes.
nNotice that the signature
and return types are the same. Also
notice that the keyword virtual only occurs in the base class' definition. It is this declaration that
enables dynamic binding.
nFinally, notice that we call the member function statement through a pointer or reference.