//Ex6_7.cpp
#include "iostream" 
using namespace std;
class Date
{private:
	int year,month,day;
 public:
    Date(){}
    Date(int y,int m,int d)
		{year=y;month=m;day=d;}
    void setdate(int y,int m,int d)
		{year=y;month=m;day=d;}
    int getyear() const   //常成员函数
		{return year;}
    int getmonth() const
		{return month;}
    int getday() const
		{return day;}
    void show() const
		{cout<<year<<"-"<<month<<"-"<<day<<endl;}
};
void main()
{Date d1;
 const Date d2(2008,8,6);
 d1.setdate(2010,10,12);
 d1.show();
 d1.setdate(2009,7,1);
 d1.show();
 //d2.setdate(2009,7,1);   //d2为常对象不能被修改，若去掉注释则出错
 d2.show();
}
