#include <iostream>
using namespace std;
class Publication{
	private:
		string title,name,date;
		int price;
	public:
		Publication(){inputData();}
		Publication(string _title,string _name,int _price,string _date):title(_title),name(_name),price(_price),date(_date){}
		void inputData(){
			cout<<"请输入标题:"<<endl;
			cin>>title; 
			cout<<"请输入书名:"<<endl;
			cin>>name;
			cout<<"请输入价格:"<<endl;
			cin>>price;
			cout<<"请输入日期:"<<endl;
			cin>>date; 
		}
		void display(){
			cout<<"标题:"<<title<<endl;
			cout<<"书名:"<<name<<endl;
			cout<<"价格:"<<price<<endl;
			cout<<"日期:"<<date<<endl;
		}
		~Publication(){}
};
class Book:public Publication{
	private:
		int page;
	public:
		Book(){inputData();}
		Book(string _title,string _name,int _price,string _date,int _page):Publication(_title,_name,_price,_date),page(_page){}
		void inputData(){
			//Publication::inputData();
			cout<<"请输入页数:"<<endl;
			cin>>page; 
		}
		void display(){
			Publication::display();
			cout<<"页数:"<<page<<endl;
		}
		~Book(){}
}; 
class CD:public Publication{
	private:
		int playtime;
	public:
		CD(){inputData();}
		CD(string _title,string _name,int _price,string _date,int _playtime):Publication(_title,_name,_price,_date),playtime(_playtime){}
		void inputData(){
			//Publication::inputData();
			cout<<"请输入播放时间:"<<endl;
			cin>>playtime; 
		}
		void display(){
			Publication::display();
			cout<<"播放时间:"<<playtime<<endl;
		}
		~CD(){}
}; 
int main(){
	Publication pub;
	Book book;
	CD cd;
	pub.display();
	book.display();
	cd.display();
	return 0;
}