#include "Date.h" Date::Date(void) { month = 1; day = 1; year = 2000; } Date::Date(int m, int d, int y) { month = m; day = d; year = y; } int Date::get_day() const { return day; } int Date::get_month() const { return month; } int Date::get_year() const { return year; } void Date::set_date(int m, int d, int y) { month = m; day = d; year = y; } bool Date::operator <(const Date &compare) { if (year < compare.year) return true; if (year > compare.year) return false; // if haven't returned, years must be equal if (month < compare.month) return true; if (month > compare.month) return false; // if haven't returned yet, year and month are equal if (day < compare.day) return true; return false; } bool operator ==(const Date& d1, const Date& d2) { return (d1.day == d2.day && d1.month == d2.month && d1.year == d2.year); } bool operator >(const Date& d1, const Date& d2) { // true if year is later, or years are the same and either // month is greater OR months are the same and day is later. if (d1.get_year() > d2.get_year() || (d1.get_year() == d2.get_year() && (d1.get_month() > d2.get_month() || (d1.get_month() == d2.get_month() && d1.get_day() > d2.get_day())))) return true; return false; }