| 4 | using namespace std; |
| 5 | |
| 6 | class DayTime |
| 7 | { |
| 8 | private: |
| 9 | int hour, minute, second; |
| 10 | |
| 11 | public: |
| 12 | DayTime() |
| 13 | { |
| 14 | hour = 0; |
| 15 | minute = 0; |
| 16 | second = 0; |
| 17 | } |
| 18 | |
| 19 | DayTime(int h, int m, int s) |
| 20 | { |
| 21 | hour = h; |
| 22 | minute = m; |
| 23 | second = s; |
| 24 | } |
| 25 | int getHour() const |
| 26 | { |
| 27 | return hour; |
| 28 | } |
| 29 | int getMinute() const |
| 30 | { |
| 31 | return minute; |
| 32 | } |
| 33 | int getSecond() const |
| 34 | { |
| 35 | return second; |
| 36 | } |
| 37 | |
| 38 | void DisplayTime() |
| 39 | { |
| 40 | cout << "HH: " << hour << endl |
| 41 | << "MM: " << minute << endl |
| 42 | << "SS: " << second << endl; |
| 43 | } |
| 44 | int asSeconds() const |
| 45 | { |
| 46 | return (3600 * hour + 60 * minute + second); |
| 47 | } |
| 48 | |
| 49 | friend void operator<<(ostream &out, DayTime &h); |
| 50 | friend void operator>>(istream &in, DayTime &h); |
| 51 | friend void operator++(DayTime &MainDayTime); |
| 52 | friend void operator--(DayTime &MainDayTime2); |
| 53 | }; |
| 54 | |
| 55 | void operator>>(istream &in, DayTime &h) |
| 56 | { |
nothing calls this directly
no outgoing calls
no test coverage detected