Another object-oriented model concept is also enabled by class derivation -- polymorphism (Greek: "having multiple forms").
Consider a bird's flap method. Depending on species, the flap method can be used to
fly,
swim,
exercise,
or communicate with other birds.
Similarly, class derivatives can provide alternative behaviors for a common method of the base class.
The query time example uses a variety of classes that are derivatives of an abstract emitter base class.
|
When the emit method is performed, the specific class derivative renders the time of day using its specific technique.