13 -2 -1 物件成員-student類別 n 在C++類別宣告的成員資料除了可以使用資料型 態、結構和陣列變數外,也可以使用其他類別的 物件變數。例如:student類別的宣告擁有date 物件的成員資料,如下所示: class student { private: int id; double test 1, test 2, test 3; date *birthday; double get. Average() const; public: student(int id, int m, int y); void set. Test(double t 1, double t 2, double t 3); void print. Student() const; };
13 -2 -1 物件成員-date類別 n date類別宣告,如下所示: class date { private: int day, month, year; public: date(int d, int m, int y); void print. Date() const; };