C++新手,完成老师布置的作业,练习多重继承,代码出现错误,弄半天弄不懂,求大神指教
#include<iostream>#include<string>
using namespace std;
Class Date
{
public:
Date(int Nian,int Yue,int Ri)
{
nian=Nian;
yue=Yue;
ri=Ri;
}
void display()
{
cout<<nian<<" "<<yue<<" "<<ri<<endl;
}
private:
int nian;
int yue;
int ri;
};
Class Time
{
public:
Time(int Shi,int Fen,int Miao){Shi=shi;Fen=fen;Miao=miao;}
void display1()
{
cout<<shi<<":"<<fen<<":"<<miao<<endl;
}
private:
int shi;
int fen;
int miao;
};
Class Week:public Date,public Time
{
public:
Week(int Nian,int Yue,int Ri,int Shi,int Fen,int Miao,string xq):
Date(Nian,Yue,Ri),Time(Shi,Fen,Miao)
void show()
{
cout<<Nian<<" "<<Yue<<" "<<Ri<<endl;
cout<<Shi<<":"<<Fen<<":"<<Miao<<endl;
cout<<xq<<endl;
}
private:
string xq;
};
int main()
{
Week week(2015,11,11,22,43,50,"xqs");
week.show();
return 0;
}
代码出现如下错误:D:\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(5) : error C2146: syntax error : missing ';' before identifier 'Date'
D:\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(5) : error C2501: 'Class' : missing storage-class or type specifiers
D:\Microsoft Visual Studio\Common\MSDev98\Bin\Cpp1.cpp(5) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
求大牛指教!!!1