-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpersonInfo.cpp
More file actions
72 lines (62 loc) · 1.35 KB
/
Copy pathpersonInfo.cpp
File metadata and controls
72 lines (62 loc) · 1.35 KB
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
#include "personInfo.h"
#include <iomanip>
using namespace std;
personInfo::personInfo() {
this->_name = "";
this->_phone = "";
this->_address = "";
}
personInfo::personInfo(personInfo &info) {
this->_name = info._name;
this->_phone = info._phone;
this->_address = info._address;
}
personInfo::~personInfo() {
this->_name = "";
this->_phone = "";
this->_address = "";
}
string personInfo::name() {
return this->_name;
}
void personInfo::name(string name) {
this->_name = name;
}
string personInfo::phone() {
return this->_phone;
}
void personInfo::phone(string phone) {
this->_phone = phone;
}
string personInfo::address() {
return this->_address;
}
void personInfo::address(string address) {
this->_address = address;
}
personInfo& personInfo::operator= (personInfo& rinfo) {
this->_name = rinfo._name;
this->_phone = rinfo._phone;
this->_address = rinfo._address;
return *this;
}
bool personInfo::operator== (personInfo& rinfo) {
bool isEqual = false;
if (this->_name == rinfo._name) {
isEqual = true;
}
return isEqual;
}
bool personInfo::operator== (string name) {
bool isEqual = false;
if (this->_name == name) {
isEqual = true;
}
return isEqual;
}
ostream& operator<< (ostream &os, personInfo &rinfo) {
os << left << setw(7) << rinfo.name()
<< left << setw(14) << rinfo.phone()
<< left << setw(50) << rinfo.address();
return os;
}