previous | start | next

## Polymorphism

- The compiler realizes that a `TravelClock` is a special case of a `Clock`, and permits the assignment

  >     clocks[1] = TravelClock(true, "Rome", 9);

- However, there is no room to store the derived-class data.
- That data simply gets sliced away when a derived-class object is assigned to a base-class variable.

- The output from the program (above) is

  >     Local time is 21:15
  >     Local time is 21:15
  >     Local time is 21:15

previous | start | next