1 #include <iostream.h>
2
3 class CDate
4 {
5 public:
6 CDate();
7 CDate(int nYear, int nMonth, int nDay);
8 private:
9 unsigned int m_nYear;
10 unsigned int m_nMonth;
11 unsigned int m_nDay;
12 };
13 CDate::CDate()
14 {
15 m_nYear = 0;
16 m_nMonth = 0;
17 m_nDay = 0;
18 }
19 CDate::CDate(int nYear, int nMonth, int nDay)
20 {
21 m_nYear = nYear;
22 m_nMonth = nMonth;
23 m_nDay = nDay;
24 }
25
26 class CStudent
27 {
28 public:
29 CStudent();
30 private:
31 int m_nAge;
32 CDate date;
33 };
34 CStudent::CStudent()
35 :date(1989,1,26)
36 {
37 cout<<"CStudent::CStudent()"<<endl;
38 }
39 void main(int argc, char* argv[])
40 {
41 CStudent stu;
42 }
posted on 2014-09-18 19:23
batstying 阅读(251)
评论(0) 编辑 收藏 引用