The class Card Pile

All the various piles of cards in the game will descend from a common parent class CardPile. Instances of this class will maintain a linked list of cards, using the list abstraction we defined earlier. Methods are provided to add or remove cards from the pile.

Five methods are then used to define the behavior that will be specialized by the various different types of card pile. These five behaviors are as follows:
The method includes will take a pair of screen coordinates, and determine if the point is included in the area covered by the pile.

The method select will perform whatever action is necessary when the pile is selected by user using the mouse. The default behavior is to do nothing.

The method addCard adds a card to the card pile.

The method display displays the card pile. The default behavior is to simply display the topmost card.

The method canTake determines if the pile can take a given card. The default behavior is to just say no.

[audio] [real] Text to accompany slide14, in Chapter 8 of An Introduction to Object-Oriented Programming