کلاس time
یک شنبه 7 آذر 1389 12:51 AM
1 // Declaration of class Time.
2 // Member functions defined in Time.cpp.
3
4 // prevent multiple inclusions of header file
5 #ifndef TIME_H
6 #define TIME_H
7
8 // Time abstract data type definition
9 class Time
10 {
11 public:
12 Time( int = 0, int = 0, int = 0 ); // default constructor
13
14 // set functions
15 void setTime( int, int, int ); // set hour, minute, second
16 void setHour( int ); // set hour (after validation)
17 void setMinute( int ); // set minute (after validation)
18 void setSecond( int ); // set second (after validation)
19
20 // get functions
21 int getHour(); // return hour
22 int getMinute(); // return minute
23 int getSecond(); // return second
24
25 void printUniversal(); // output time in universal-time format
26 void printStandard(); // output time in standard-time format
27 private:
28 int hour; // 0 - 23 (24-hour clock format)
29 int minute; // 0 - 59
30 int second; // 0 - 59
31 }; // end class Time
32
33 #endif