Subclass polymorphism examples
Class A
has an integer member called index
and A
has a function doIncrement()
.
Class B
inherits from A
, and b
is an instance of class B
.
Class C
also inherits from A
, and c
is an instance of class C
.
Classes B
and C
both overload the
method doIncrement()
in different ways.
-
C++
polymorphism.cc -
Python
polymorphism.py