c++新手,求高手解释一下,组合类问题,脑袋很晕乎
求高手解释一下为什么么老是报错说Person类里没有前几个的定义
#include <iostream>
using namespace std;
class Time
{
public:
Time(int m,int n,int k): i(m),j(n),t(k){}//{m=a,n=b};内嵌对象的初始化
Time(Time&n);
~Time();
private:
int i,j,t;
};
//inline Time::getM(){cin>>m;}
//inline Time::getN(){cin>>n;}
//inline Time::getK(){cin>>k;}
Time::Time(Time &a):i(a.i),j(a.j),t(a.t)
{
cout<<a.i<<" "<<a.j<<" "<<a.t<<endl;
}
class Person
{
public:
Person(int Mnm, int ID,Time xp1):x(Mun),z(ID),xp(xp1){}
{
cout<<"组合类构造函数实现"<<endl;
}
//内嵌对象初始化
Person(Person&a);
private:
int x,z,Time xp;
}
//Person::Person(int Mnm, int ID,Time xp1)
Person::Person(Person &a):x(a.x),z(a.z),xp(a.xp)
{cout<<"组合类复制构造函数已经被引用"<<endl;}
int main()
{
Time a(1,2,3);
Person b(1312,Time a,1111);
Person c(b);
return 0;
}