-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPERSON.cpp
57 lines (53 loc) · 1.27 KB
/
PERSON.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
//
// PERSON.cpp
// Lab5
//
// Created by Lily Tang on 5/30/19.
// Copyright © 2019 Lily Tang. All rights reserved.
//
#include "PERSON.h"
#include <string>
#include <iostream>
using namespace std;
ostream &operator << (ostream &strm, Person &obj){
strm << obj.name << "\t"<< obj.birthDate << endl;
return strm;
}
Person::Person(string n, string b){
name = n;
birthDate = b;
}
void Person::setBirth(string b){
birthDate = b;
}
void Person::setName(string f){
name = f;
}
string Person::getBirth()const{
return birthDate;
}
string Person::getName() const{
return name;
}
void Person::operator = (const Person &r){
name = r.name;
birthDate = r.birthDate;
}
bool Person::operator == (const Person &right) const{
return (birthDate == right.birthDate);
}
bool Person::operator != (const Person &right) const{
return (birthDate != right.birthDate);
}
bool Person::operator < (const Person &right) const{
return (birthDate < right.birthDate);
}
bool Person::operator > (const Person &right) const{
return (birthDate > right.birthDate);
}
bool Person::operator >= (const Person &right) const{
return (birthDate >= right.birthDate);
}
bool Person::operator <= (const Person &right) const{
return (birthDate <= right.birthDate);
}