More generally, you define a virtual member function under the following circumstances:
superclass
.
superclass
. Suppose
that the subclass is named subclass
.
member_function
, on
the basis of the object's class, subclass
.
Then, you must define a version of member_function
in
superclass
, and you must mark that function with
virtual
. That member function and all versions defined in
classes that are subclasses of superclass
are said to be
virtual member functions.