go to previous page   go to home page   go to next page

Answer:

As many as I sent.


Greeting Card Hierarchy

birthday cards

This chapter develops a hierarchy of greeting cards. 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 never be an object that is merely a "Card." The Card class represents the abstract concept of "Card." All actual card objects must be more specific.


QUESTION 2:

If you had a shoe box full of greeting cards you had received over the years — Valentine cards, birthday cards, holiday cards, and so on — what would be a good label to write on the box?