#include "date.h" // Date member functions ******************************************* // default constructor: creates day of form month/day/year Date::Date(int month, int day, int year) : thisMonth(1), thisDay(1), thisYear(2000) { // initialize placeholders // now we can set date correctly setMonth(month); setDay(day); setYear(year); } // inspector getMonth(): returns the month associated with the date int Date::getMonth() const { return thisMonth; } // inspector getDay(): returns the day associated with the date int Date::getDay() const { return thisDay; } // inspector getYear(): returns the year associated with the date int Date::getYear() const { return thisYear; } // facilitator insert(): displays a representation of the date to // stream sout. The representation has form month/day/year. void Date::insert(ostream &sout) const { int month = getMonth(); int day = getDay(); int year = getYear(); sout << month << "/" << day << "/" << year; } // Date auxiliary operators *************************************** // operator >>: extracts a date of form month/day/year from sin and assigns // it to target. The operator is supplied as a client courtesy, The operator // makes use of date member function extract istream& operator >> (istream &sin, Date &target) { target.extract(sin); return sin; } // operator <<: inserts the date to sout with form month/day/year. The // operator is supplied as a client courtesy, The operator makes use of // date member function insert ostream& operator << (ostream &sout, const Date &source) { source.insert(sout); return sout; }