21.2 Polymorphic Variables (cont.)
- Pointer or reference declared with one type
- May hold a variable of a derived type:
Employee* emp = new Manager("Sarah Smith", 67000, 2000);
- Employee* is the static type
- Manager* is the dynamic type
- Dynamic type determined at run time
- Can change during execution
prev
|top
|next