previous | start | next

## Derived Classes

- The `Clock` class presented in `clocks1.cpp` provides a base class that can tell the current local time.
- You can set a clock to either "military" or "am/pm" format.
- We will create a derived class, `TravelClock` that gains two additional data fields: `location` and `time_difference`.

- The time for a `TravelClock` is computed by taking the local time and adding the time difference.

  >     TravelClock clock("New York", 3);
  >     cout << "The time in " << clock.get_location() << " is "
  >        << clock.get_hours() << ":" << clock.get_minutes();

previous | start | next