ADD file via upload

main
pe9xjwfro 5 months ago
parent e83105c264
commit 832dedb83e

@ -0,0 +1,51 @@
#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();//ÊäÈëÊý¾Ý
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
Loading…
Cancel
Save