From c5d712babebb2d491170e0c9e16765fe75683d34 Mon Sep 17 00:00:00 2001 From: BinHong Lee Date: Mon, 18 Apr 2016 14:00:42 -0700 Subject: [PATCH] Getters and setters added Getters and setters for the variables in Person.cpp is now added. --- Person.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++------ Person.h | 9 +++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Person.cpp b/Person.cpp index 461752b..4722bd5 100644 --- a/Person.cpp +++ b/Person.cpp @@ -1,10 +1,46 @@ #include #include "Person.h" +using namespace std; Person::Person(string name, string password, string email, string phoneNo) - { - this->name = name; - this->password = password; - this->email = email; - this->phoneNo = phoneNo; - } +{ + this->name = name; + this->password = password; + this->email = email; + this->phoneNo = phoneNo; +} + +void Person::setName(string name) +{ + this->name = name; +} + +string Person::getName() +{ + return name; +} + +void Person::setEmail(string email) +{ + this->email = email; +} + +string Person::getEmail() +{ + return email; +} + +void Person::setPhoneNo(string phoneNo) +{ + this->phoneNo = phoneNo; +} + +bool Person::checkPassword(string password) +{ + return (this->password == password); +} + +void Person::setPassword(string password) +{ + this->password = password; +} diff --git a/Person.h b/Person.h index 05a29a9..e1a4f73 100644 --- a/Person.h +++ b/Person.h @@ -4,6 +4,7 @@ using namespace std; class Person { + private : string name; string password; string email; @@ -11,4 +12,12 @@ class Person public : Person(string, string, string, string); + void setName(string); + string getName(); + void setEmail(string); + string getEmail(); + void setPhoneNo(string); + string getPhoneNo(); + void setPassword(string); + bool checkPassword(string); };