| Introduction to OOP | Chapter 17: The Polymorphic Variable : | next | previous | audio | real | text |
public class Solitaire {
...
static CardPile allPiles [ ];
...
public void paint(Graphics g) {
for (int i = 0; i < 13; i++)
allPiles[i].display(g);
}
...
}
The variable was declared as CardPile, but actually held a number of
different types.