#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(5,12,32,1995,1,24,"dadada");
a.display();
return 0;
}
5.17
最新推荐文章于 2024-05-24 08:09:37 发布