#include <iostream>
using std::cout;
using std::endl;
class Date
{
public:
Date( int = 1, int = 1, int = 2007 );
void print();
private:
int month;
int day;
int year;
};
Date::Date( int m, int d, int y )
{
month = m;
day = d;
year = y;
}
void Date::print()
{
cout << month << '/' << day << '/' << year;
}
int main()
{
Date date1( 8, 8, 2008 );
Date date2;
cout << "date1 = ";
date1.print();
cout << "\ndate2 = ";
date2.print();
date2 = date1;
cout << "\n\nAfter default memberwise assignment, date2 = ";
date2.print();
cout << endl;
return 0;
}
|