class Time
1: // Filename: TIME1.H
2: // Purpose: Specification file for a simple Time class.
4: #ifndef TIME1_H
5: #define TIME1_H
7: class Time
8: {
9: public:
10: void Set(/* in */ int hoursNew,
11: /* in */ int minutesNew,
12: /* in */ int secondsNew);
13: // Pre: 0 <= hoursNew <= 23
14: // 0 <= minutesNew <= 59
15: // 0 <= secondsNew <= 59
16: // Post: Time is set according to the incoming parameters.
17: // Note that this function must be called prior to a call
18: // to any other member function.
20: void Increment();
21: // Pre: The Set function has been called at least once.
22: // Post: Time has been advanced by one second, with
23: // 23:59:59 wrapping around to 00:00:00.
25: void Display() const;
26: // Pre: The Set function has been called at least once.
27: // Post: Time has been output in the form HH:MM:SS.
29: private:
30: int hours;
31: int minutes;
32: int seconds;
33: };
35: #endif