#include "Clock.h" using std::ostream; Clock::Clock(const Clock &c) { minute = c.minute; } Clock::Clock(Clock &&c) { minute = c.minute; } int Clock::GetMinute() { return minute % 60; } int Clock::GetHour() { return minute / 60; } string Clock::GetMeridiem() { if (GetHour() / 12 % 2) { return "pm"; } else { return "am"; } } inline bool Clock::operator==(const Clock &t) const { return minute == t.minute; } inline bool Clock::operator>=(const Clock &t) const { return minute >= t.minute; } inline bool Clock::operator>(const Clock &t) const { return minute > t.minute; } inline bool Clock::operator<=(const Clock &t) const { return minute <= t.minute; } inline bool Clock::operator<(const Clock &t) const { return minute < t.minute; } inline bool Clock::operator!=(const Clock &t) const { return minute != t.minute; } Clock &Clock::operator+=(const Clock &t) { minute += t.minute; return *this; } Clock &Clock::operator-=(const Clock &t) { minute -= t.minute; return *this; } inline Clock &Clock::operator++() { minute++; return *this; } inline Clock &Clock::operator--() { minute--; return *this; } Clock &Clock::operator=(const Clock &t) { minute = t.minute; return *this; } Clock &Clock::operator=( Clock&& t) { minute = t.minute; return *this; } inline Clock operator+(Clock lhs, const Clock &rhs) { return lhs.minute += rhs.minute; } inline Clock operator-(Clock lhs, const Clock &rhs) { return lhs.minute -= rhs.minute; } ostream& operator<<(std::ostream& os, Clock& t) { os << t.GetHour() << ":" << std::setw(2) << std::setfill('0') << t.GetMinute() << t.GetMeridiem() << std::endl; return os; }