You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.6 KiB

#pragma once
#ifndef TEACHER_H
#define TEACHER_H
#include <iostream>
#include <string>
#include <cstring>
#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();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
virtual void displayDetails(); //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
};
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