worker.h

来自「用C++编写的教师学生相关信息和统计系统」· C头文件 代码 · 共 47 行

H
47
字号
#include"common_people.h"
#ifndef worker_h
#define worker_h

class worker:virtual public common_people
{ 
	friend class list;
public:
	char department3[30];
    char post2[30];
	worker()
		{
			common_people();
            department3[0]=post2[0]='\0';		
		}
	worker(char *name1,int num,char *sex1,char *birth,char *depart,char*post0):common_people(name1,num,sex1,birth)
		{
		  
		  strcpy(department3,depart);
	      strcpy(post2,post0);
		}
	virtual void print();
	virtual void getnode();
	virtual void sav(char *nam);
};
//
void worker::sav(char *nam)
{   ofstream out(nam,ios_base::app);
	out<<7<<endl<<type<<endl<<number<<endl<<name<<endl<<sex<<endl<<birthday<<endl<<maths<<endl<<computer<<endl<<english<<endl;
	out<<department3<<endl<<post2<<endl;
	out.close();
}
//
void worker::print()
{
	common_people::print();
	cout<<"工作部门:"<<department3<<"   职位:"<<post2<<endl;
}

//
void worker::getnode()
{
   ptr=new worker(name,number,sex,birthday,department3,post2);

}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?