ch12_7.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:1k
源码类别:
C#编程
开发平台:
Visual C++
- //**********************
- //** ch12_7.cpp **
- //**********************
- #include <iostream.h>
- class Tdate{
- public:
- Tdate(){ Init(4,15,1995); }
- Tdate(int d){ Init(4,d,1996); }
- Tdate(int m,int d){ Init(m,d,1997); }
- Tdate(int m,int d,int y){ Init(m,d,y); }
- //其他公共成员
- protected:
- int month;
- int day;
- int year;
- void Init(int m,int d,int y)
- {
- month=m; day=d; year=y;
- cout <<month <<"/" <<day <<"/" <<year <<endl; }
- };
- void main()
- {
- Tdate aday;
- Tdate bday(10);
- Tdate cday(2,12);
- Tdate dday(1,2,1998);
- }