previous | start | next

## Derived Class

- A `TravelClock` differs from a `Clock` in three ways:
  - Its objects store the location and time difference.
  - The `get_hours` function of the `TravelClock` adds the time difference to the current time.
  - The `get_location` function returns the actual location, not the string `"Local"`.
- When the `TravelClock` class inherits from the `Clock` class, it needs only to spell out these three differences.

  >     class TravelClock : public Clock
  >     {

  >     public:
  >        TravelClock(bool mil, string loc, double off);
  >        int get_hours() const;
  >        string get_location() const;
  >     private:
  >        string location;
  >        int time_difference;
  >     };

previous | start | next