From 832dedb83e66435959ffbfaab4910bb530aae7aa Mon Sep 17 00:00:00 2001 From: pe9xjwfro <2153257690@qq.com> Date: Mon, 17 Jun 2024 20:38:40 +0800 Subject: [PATCH] ADD file via upload --- teacher.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 teacher.h diff --git a/teacher.h b/teacher.h new file mode 100644 index 0000000..707f0c9 --- /dev/null +++ b/teacher.h @@ -0,0 +1,51 @@ +#pragma once +#ifndef TEACHER_H +#define TEACHER_H +#include +#include +#include +#include "person.h" +using namespace std; +class Teacher : virtual public Person { +protected: + char TeacherNo[5]; + char SchoolName[20]; + char Department[20]; +public: + Teacher(); + Teacher(char* sname, char* sid, char* sgender, int y, int m, int d, char* steacherNo, char* sschool, char* + sdepartment); + ~Teacher() {}; + void setTeacherNo(char* sno) { strcpy(TeacherNo, sno); } + char* getteacherNo() { return TeacherNo; } + void setSchoolName(char* sschool) { strcpy(SchoolName, sschool); } + char* getSchoolName() { return SchoolName; } + void setDepartment(char* sdepartment) { strcpy(Department, sdepartment); } + char* getDepartment() { return Department; } + virtual void inputData();//输入数据 + virtual void displayDetails(); //显示数据 +}; +Teacher::Teacher() :Person() { + strcpy(TeacherNo, "001"); + strcpy(SchoolName, "null_school"); + strcpy(Department, "null_department"); +} +Teacher::Teacher(char* sname, char* sid, char* sgender, int y, int m, int d, char* steacherNo, char* sschool, char* + sdepartment) :Person(sname, sid, sgender, y, m, d) { + strcpy(TeacherNo, steacherNo); + strcpy(SchoolName, sschool); + strcpy(Department, sdepartment); +} +void Teacher::inputData() { + Person::inputData(); + cout << "teacherNo: "; cin >> TeacherNo; + cout << "School: "; cin >> SchoolName; + cout << "Department"; cin >> Department; +} +void Teacher::displayDetails() { + Person::displayDetails(); + cout << "TeahcerNo: " << TeacherNo << endl; + cout << "School: " << SchoolName << endl; + cout << "Deartment: " << Department << endl; +} +#endif //TEACHER_H \ No newline at end of file