previous | start | next

## Polymorphism

- Unfortunately, the following code does still not work!

  >     cout << clocks[i]->get_location() << " time: "
  >        << clocks[i]->get_hours() << ":"
  >        << setw(2) << setfill('0')
  >        << clocks[i]->get_minutes()
  >        << setfill(' ') << "\n";

- The output is still

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

- Recall that both `Clock` and `TravelClock` have a `get_location` and a `get_hours` member function.
- The compiler calls the `Clock` member function because the pointer is of type `Clock*`.

previous | start | next