关于类的继承的一些程序,请问错在哪了,求解
// Note:Your choice is C++ IDE#include <iostream>
using namespace std;
class publication{
private:
int price,year,month,day;
public:
char title[10];
char name[10];
int a,int b,int c;
publication();
~publication();
void inputdata()
{
cout<<"请输入出版日期a,b,c的值:"<<endl;
cin>>a>>b>>c;
cout<<"请输入出版物的标题:"<<endl;
for(int i=0;i<10;i++)
{
cin>>title[i];
}
cout<<"请输入出版物的名称:"<<endl;
for(i=0;i<10;i++)
{
cin>>name[i];
}
cout<<"请输入单价:"<<endl;
cin>>price;
}
int getprice(){return price;}
void date()
{
year=a;
month=b;
day=c;
cout<<year<<"."<<month<<"."<<day;
}
void display()
{
cout<<"出版物的标题为:"<<endl;
cout<<title<<endl;
cout<<"出版物的名称为:"<<endl;
cout<<name<<endl;
cout<<"出版物的单价为:"<<endl;
cout<<price<<endl;
cout<<"出版日期为:"<<endl;
date();
}
};
class book:public publication{
private:
int page;
public:
int getpage(){return page;}
book();
~book();
void inputdata()
{
publication::inputdata();
cout<<"请输入需要保存的图书页数:"<<endl;
cin>>page;
}
void display()
{
publication::display();
cout<<"保存的图书页数为:"<<endl;
cout<<page;
}
};
class tape:public publication{
private:
int hour,minute,second;
public:
int l,m,n;
void playtime()
{
hour=l;
minute=m;
second=n;
cout<<hour<<"."<<minute<<"."<<second;
}
tape();
~tape();
void inputdata()
{
publication::inputdata();
cout<<"请输入要保存的播放时间:"<<endl;
cin>>l>>m>>n;
}
void display()
{
publication::display();
cout<<"保存的播放时间为:"<<endl;
playtime();
}
};
void main()
{
publication p;
book b;
tape t;
p.inputdata();
p.display();
b.inputdata();
b.display();
t.inputdata();
t.display();
}