📄 client.cpp
字号:
#include<iostream>
#include"Client.h"
using namespace std;
/* Initializes the private data members to default values */
Client::Client(void):fname(""),lname(""),email(""),passwd(""){}
/* Makes a copy of a Client object */
Client::Client(Client const &c){
fname = c.getFname();
lname = c.getLname();
email = c.getEmail();
passwd = c.getPasswd();
}
/* Accepts parameters to initialize the private data members */
Client::Client (string &fname, string &lname, string &email, string &passwd):fname(fname),lname(lname),email(email),passwd(passwd){}
/* Set the first name */
void Client::setFname(const string& fname){
this->fname = fname;
}
/* Set the last name */
void Client::setLname(const string& lname){
this->lname = lname;
}
/* Set the email */
void Client::setEmail(const string& email){
this->email = email;
}
/* Set the password */
void Client::setPasswd(const string& passwd){
this->passwd =passwd;
}
/* Get the first name */
string Client::getFname () const{
return fname;
}
/* Get the last name */
string Client::getLname () const{
return lname;
}
/* Get the email */
string Client::getEmail () const{
return email;
}
/* Get the password */
string Client::getPasswd () const{
return passwd;
}
/*
* Returns true if the invoking object's password matches
* the password given in the parameter, false if otherwise
*/
bool Client::verifyPasswd(string passwd){
if(this->passwd == passwd){
return true;
}
else
return false;
}
/* This method reads a Client object from an input stream */
istream &operator>>(istream &stream, Client &c){
string m;
char n;
stream >> m;
c.setFname(m);
stream >> n;
stream >> m;
c.setLname(m);
stream >> n;
stream >> m;
c.setEmail(m);
stream >> n;
stream >> m;
c.setPasswd(m);
stream >> n;
return stream;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -