#include<iostream>
#include<string>
using namespace std;
class Time
{
public:
Time(int a,int b,int c):hours(a),minutes(b),seconds(c)
{}
void display()
{
cout<<"出生时间:"<<" "<<"时"<<hours<<" "<<"分"<<minutes<<" "<<"秒"<<seconds<<endl;
}
protected:
int hours,minutes,seconds;
};
class Date
{
public:
Date(int m,int n,int y)
{
year=m;
month=n;
day=y;
}
void display()
{
cout<<"出生年月:"<<"年"<<year<<"."<<"月"<<month<<"."<<"日"<<day<<endl;
}
protected:
int year;
int month;
int day;
};
class Birthtime:public Time,public Date
{
string Childname;
public:
Birthtime(int a,int b,int c,int i,int j,int k,string s):Time(a,b,c),Date(i,j,k)
{Childname=s;}
void display()
{
cout<<"Clildname:"<<Childname<<":";
Date::display();
Time::display();
}
};
int main()
{
Birthtime a(3,10,36,1996,7,08,"benlen");
a.display();
return 0;
}
5.17
最新推荐文章于 2019-09-18 10:16:50 发布