As many as I sent.
The example of this chapter is a hierarchy of greeting cards types.
The parent class is Card
,
and its children classes are Valentine
, Holiday
, and Birthday
.
A card object will have a greeting()
method that writes out a greeting.
Each type of card contains an appropriate greeting.
The Holiday card says "Season's Greetings."
The Birthday card says "Happy Birthday."
The Valentine cards says "Love and Kisses."
In this example,
an object must be an instance of one of the three child types:
Valentine
, Holiday
, and Birthday
.
There will be no such thing as an object that is merely a "Card."
The Card
class represents the abstract concept of "Card."
All actual card objects must be more specific.