#include #include #include "Time.h" using namespace std; Time :: Time(const int h, const int m, const int s) : hour(h), minute (m), second(s) { } void Time :: setTime(const int h, const int m, const int s) { hour = h; minute = m; second = s; } bool Time :: equals(const Time &otherTime) { if(hour == otherTime.hour && minute == otherTime.minute && second == otherTime.second) return true; else return false; } void Time :: print() const { cout << setw(2) << setfill('0') << hour << ":" << setw(2) << setfill('0') << minute << ":" << setw(2) << setfill('0') << second << "\n"; } int main() { Time t1(10, 50, 59); t1.print(); // 10:50:59 Time t2; t2.print(); // 06:39:09 t2.setTime(6, 39, 9); t2.print(); // 06:39:09 if(t1.equals(t2)) cout << "Two objects are equal\n"; else cout << "Two objects are not equal\n"; return 0; }