#include<iostream>
using namespace std;
class Date
{
private:
int year, month, day;
public:
Date(int y, int m, int d)
{
year = y; month = m; day = d;
}
};
class Time
{
private:
int hour, minute, second;
public:
Time(int hour1,int minute1,int second1)
{
hour = hour1; minute = minute1; second = second1;
}
};
class DateTime
{
private:
Date date; // 數據成員為Date類的對象
Time time; // 數據成員為Time類的對象
public:
DateTime(int y, int m, int d) : date(y, m, d):time(y,m,d)
//這裡錯了怎麼弄
{
cout << this << "......" << endl;
}
};
int main()
{
DateTime dt(2014, 3, 24);
return 0;
}
DateTime(int y, int m, int d) : date(y, m, d):time(y,m,d)
第二個冒號改為逗號