📄 client.cpp
字号:
/*Class Client models a registered user of the auction system.
This class contains private data members to store the first name,
last name, email address, and password of the user. The class declaration
includes the following public members.*/
#include <iostream>
#include <string>
#include "Client.h"
//Default constructor
Client::Client(void):fname(""),lname(""),email(""),passwd("") {}
//Four parameter constructor
Client::Client(string &fname, string &lname, string &email, string &passwd) {
this->fname = fname;
this->lname = lname;
this->email = email;
this->passwd = passwd;
}
//Copy constructor
Client::Client(Client const &c) {
fname = c.fname;
lname = c.lname;
email = c.email;
passwd = c.passwd;
}
//Accessors and mutators
void Client::setFname(const string& newfname) {
fname = newfname;
}
void Client::setLname(const string& newlname) {
lname = newlname;
}
void Client::setEmail(const string& newemail) {
email = newemail;
}
void Client::setPasswd(const string& newpasswd) {
passwd = newpasswd;
}
string Client::getFname() const {
return fname;
}
string Client::getLname() const {
return lname;
}
string Client::getEmail() const {
return email;
}
string Client::getPasswd() const {
return passwd;
}
//virtual bool verifyPasswd(string passwd);
bool Client::verifyPasswd(string passwd) {
if (passwd == this->passwd)
return true;
else
return false;
}
//operator>>
istream &operator>>(istream &stream, Client &c) {
string fname,lname,email,passwd;
getline(stream,fname);
c.setFname(fname);
getline(stream,lname);
c.setLname(lname);
getline(stream,email);
c.setEmail(email);
getline(stream,passwd);
c.setPasswd(passwd);
return stream;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -