C++:类与对象
来源:百度知道 编辑:UC知道 时间:2024/05/14 02:20:59
多给些分~~~
#include<iostream.h>
class worker
{
public:
class time
{
private:
int date;
int month;
int year;
public:
time(){}
time(int d,int m,int y){date=d;month=m;year=y;}
~time(){};
const time& operator=(const time &n)
{
this->date = n.date;
this->month = n.month;
this->year = n.year;
return *this;}
inline void get_birthtime(){cout<<year<<"年 "<<month<<"月 "<<date<<"日 "<<endl;}
};
worker(){}
worker(int f, char *g ,long int id,time &b){num=f;gender=g;ID_card=id;birth=b;}
~worker(){}
worker(worker &a){num=a.num;gender=a.gender;ID_card=a.ID_card;birth=a.birth;}
void set_worker(int f, char *g ,long int id,time