📄 date1.cpp
字号:
#include <iostream.h>
class Date
{ int year,month,day;
public:
Date()
{
year=2003; month=1; day=1;
cout<<"Constructor called."<<endl;
}
Date(int y,int m,int d)
{
year=y; month=m; day=d;
cout<<"Constructor called."<<endl;
}
~Date()
{
cout<<"Destructor called."<<endl;
}
void PrintDate()
{
cout<<year<<"-"<<month<<"-"<<day<<endl;
}
};
void main()
{
Date d1,d2(2003,7,12);
cout<<"d1的具体日期为:"<<endl;
d1.PrintDate();
cout<<"d2的具体日期为:"<<endl;
d2.PrintDate();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -