The Discard Pile

The discard pile overrides the addCard function, so as to ensure that cards placed on the discard pile will always be face up.

It overrides the select method so that when the mouse is pressed in the area of the discard pile, it will try to play the topmost card, first on one of the suit piles, and then on one of the table piles. If no pile can accept the card, it is put back on the list.

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