< previous page page_916 next page >

Page 916
class ExtTime : public Time
{
public:
    void Set( /* in */ int       hours,
              /* in */ int       minutes,
              /* in */ int       seconds,
              /* in */ ZoneType timeZone );
        // Precondition:
        //     0 <= hours <= 23 && 0 <= minutes <= 59
        //  && 0 <= seconds <= 59 && timeZone is assigned
        // Postcondition:
        //     Time is set according to the incoming parameters

    void Write() const;
        // Postcondition:
        //     Time has been output in the form HH:MM:SS ZZZ
        //     where ZZZ is the time zone

    ExtTime( /* in */ int          initHrs,
             /* in */ int          initMins,
             /* in */ int          initSecs,
             /* in */ ZoneType initZone );
        // Precondition:
        //     0 <= initHrs <= 23   && 0 <= initMins <= 59
        //  && 0 <= initSecs <= 59 && initZone is assigned
        // Postcondition:
        //     Class object is constructed
        //  && Time is set according to the incoming parameters

    ExtTime ();
        // Postcondition:
        //     Class object is constructed
        //  && Time is 0:0:0 Eastern Standard Time
 private:
     ZoneType zone;
};
With this new class, the programmer can set the time with a time zone (via a class constructor or the overridden Set function), output the time with its time zone (via the overridden Write function), and increment the time by one second (via the inherited Increment function):
#include exttime.h
  .
  .
  .
ExtTime time1(8, 35, 0, PST);
ExtTime time2;                  // Default constructor called

 
< previous page page_916 next page >