people.h
来自「一个简单的people类程序」· C头文件 代码 · 共 40 行
H
40 行
#include<iostream>
#include<cstring>
using namespace std;
class data
{
public:
data(int y,int m,int d)
{
year=y;
month=m;
day=d;
cout<<"data's constructor called"<<endl;
}
data(){}
~data(){cout<<"data's destructor called"<<endl;}
void display()
{
cout<<year<<"年"<<month<<"月"<<day<<"日"<<endl;
}
private:
int year,month,day;
};
class people
{
public:
people(string n,string no,string s,data birth,string i):birthday(birth)
{
name=n;
number=no;
sex=s;
id=i;
cout<<"people's constructor called"<<endl;
}
people(){}
~people(){cout<<"people's destructor called"<<endl;}
void show();
protected:
data birthday;
string name,number,sex,id;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?