42 lines
986 B
C++
42 lines
986 B
C++
#include <iostream>
|
|
#define MAX_TEACHER_NAME_SIZE 50
|
|
#define MAX_TEACHER_SEX_SIZE 10
|
|
|
|
class Teacher {
|
|
private:
|
|
friend std::istream &operator>>(std::istream &input, Teacher &teacher);
|
|
friend std::ostream &operator<<(std::ostream &output, Teacher &teacher);
|
|
|
|
protected:
|
|
int number;
|
|
char name[MAX_TEACHER_NAME_SIZE + 1];
|
|
char sex[MAX_TEACHER_SEX_SIZE + 1];
|
|
|
|
public:
|
|
Teacher(bool interactive = false, int _number = 0, std::string _name = "Unknown",
|
|
std::string _sex = "Unknown");
|
|
|
|
// 返回更新后的num
|
|
int setNumber(int _num);
|
|
|
|
// 返回更新后的name
|
|
std::string setName(std::string _name);
|
|
|
|
// 返回更新后的name
|
|
std::string setName(char _name[]);
|
|
|
|
// 返回更新后的sex
|
|
std::string setSex(std::string _sex);
|
|
|
|
// 返回更新后的sex
|
|
std::string setSex(char _sex[]);
|
|
|
|
// 获取num
|
|
int getNumber();
|
|
|
|
// 获取name
|
|
std::string getName();
|
|
|
|
// 获取sex
|
|
std::string getSex();
|
|
}; |