Browse Source

Getters and setters added

Getters and setters for the variables in Person.cpp is now added.
Fixing-travis-yml
BinHong Lee 8 years ago
parent
commit
c5d712babe
2 changed files with 51 additions and 6 deletions
  1. +42
    -6
      Person.cpp
  2. +9
    -0
      Person.h

+ 42
- 6
Person.cpp View File

@@ -1,10 +1,46 @@
#include <string>
#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;
}

+ 9
- 0
Person.h View File

@@ -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);
};

Loading…
Cancel
Save