#include <iostream>
#include <iomanip>
using namespace std;
#include "ccc_time.h"
class Time_new : public Time {
public:
int operator-(Time_new b) const;
Time_new operator+(int sec) const;
bool operator==(Time_new b) const;
bool operator!=(Time_new b) const;
Time_new operator++(); Time_new operator++(int dummy); friend ostream& operator<<(ostream& out, Time_new a);
};
int Time_new::operator-(Time_new b) const
{ return this->seconds_from(b);
}
Time_new Time_new::operator+(int sec) const
{ Time_new r = *this;
r.add_seconds(sec);
return r;
}
bool Time_new::operator==(Time_new b) const
{ return this->seconds_from(b) == 0;
}
bool Time_new::operator!=(Time_new b) const
{ return !(*this == b);
}
Time_new Time_new::operator++() { *this = *this + 1;
return *this;
}
Time_new Time_new::operator++(int dummy) { Time_new t = *this;
*this = *this + 1;
return t;
}
ostream& operator<<(ostream& out, Time_new a)
{ out << a.get_hours() << ":"
<< setw(2) << setfill('0')
<< a.get_minutes() << ":"
<< setw(2) << a.get_seconds() << setfill(' ');
return out;
}
int main()
{ Time_new now;
cout << "now: " << now << endl;
Time_new later = now + 1000;
cout << "later: " << later << endl;
Time_new now2;
if (now == now2)
cout << "now == now2: " << now2 << endl;
if (now != now2)
cout << "now != now2 " << now2 << endl;
cout << "now++: " << now++
<< " ++now2: " << ++now2 << endl;
cout << "now: " << now << " now2: " << now2 << endl;
cout << "later - now2: " << later - now2 << endl;
return 0;
}