-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTeacher.cpp
88 lines (66 loc) · 1.79 KB
/
Teacher.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "Teacher.h"
Teacher::Teacher(const string& tname, const string& sex, int age, const string& title, int salary, int coid) : tname(
tname), sex(sex), age(age), title(title), salary(salary), coid(coid) {}
int Teacher::getTid() const {
return tid;
}
void Teacher::setTid(int tid) {
Teacher::tid = tid;
}
const string& Teacher::getTname() const {
return tname;
}
void Teacher::setTname(const string& tname) {
Teacher::tname = tname;
}
const string& Teacher::getSex() const {
return sex;
}
void Teacher::setSex(const string& sex) {
Teacher::sex = sex;
}
int Teacher::getAge() const {
return age;
}
void Teacher::setAge(int age) {
Teacher::age = age;
}
const string& Teacher::getTitle() const {
return title;
}
void Teacher::setTitle(const string& title) {
Teacher::title = title;
}
int Teacher::getSalary() const {
return salary;
}
void Teacher::setSalary(int salary) {
Teacher::salary = salary;
}
int Teacher::getCoid() const {
return coid;
}
void Teacher::setCoid(int coid) {
Teacher::coid = coid;
}
ostream& operator<<(ostream& os, const Teacher& teacher) {
os << "tid: " << teacher.tid << " tname: " << teacher.tname << " sex: " << teacher.sex << " age: " << teacher.age
<< " title: " << teacher.title << " salary: " << teacher.salary << " coid: " << teacher.coid;
return os;
}
bool Teacher::operator==(const Teacher& rhs) const {
return tid == rhs.tid &&
tname == rhs.tname &&
sex == rhs.sex &&
age == rhs.age &&
title == rhs.title &&
salary == rhs.salary &&
coid == rhs.coid;
}
bool Teacher::operator!=(const Teacher& rhs) const {
return !(rhs == *this);
}
Teacher::~Teacher() {
//
cout << "½Ìʦ¶ÔÏó" << this->tname << "ÒѾÏú»Ù" << endl;
}