Introduction to OOP Chapter 17: The Polymorphic Variable : next previous audio real text

Simple Polymorphic Variables

We saw simple polymorphic variables in the Solitare case study.
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.
Intro OOP, Chapter 17, Slide 02