#include // class declaration class Date { private: int month; int day; int year; public: Date(int = 7, int = 4, int = 2001); // constructor Date operator=(const Date&); // define assignment of a date void showdate(); // member function to display a date }; // implementation section Date::Date(int mm, int dd, int yyyy) { month = mm; day = dd; year = yyyy; } Date Date::operator=(const Date& newdate) { day = newdate.day; // assign the day month = newdate.month; // assign the month year = newdate.year; // assign the year return *this; } void Date::showdate(void) { cout << setfill('0') << setw(2) << month << '/' << setw(2) << day << '/' << setw(2) << year % 100; cout << endl; return; } int main() { Date a(4,1,1999), b(12,18,2001), c(1,1,2002); // declare three objects cout << "Before assignment a's date value is "; a.showdate(); cout << "Before assignment b's date value is "; b.showdate(); cout << "Before assignment c's date value is "; c.showdate(); a = b = c; // multiple assignment cout << "\nAfter assignment a's date value is "; a.showdate(); cout << "After assignment b's date value is "; b.showdate(); cout << "After assignment c's date value is "; c.showdate(); return 0; }