previous | index | next

Implementing Polymorphism

The ItemInfo class must have display declared in it.

But the OxfordShirtInfo and ChinoInfo classes must supply specific versions of display.

This can be done by:

Declaring a method to be virtual causes the behavior of the method to depend on the type of its object at run time.

previous | index | next