// date.cpp // this file contains the method definitions for the date class #include #include "date.h" // constructor Date::Date(int m, int d, int y) { month = m; // or just call set(m,d,y); day = d; year = y; } // equality operator bool operator ==(const Date& d1, const Date& d2) { return ( (d1.month == d2.month) && (d1.day == d2.day) && (d1.year == d2.year)); } // this sets a Date object to a given date void Date::set(int m, int d, int y) { month = m; day = d; year = y; } // this method displays the Date on the screen void Date::print() { cout << month << '/' << day << '/' << year; } // this reads a Date in from cin void Date::read() { cout << "Enter the month: "; cin >> month; cout << "Enter the day: "; cin >> day; cout << "Enter the year: "; cin >> year; }