client.cpp

来自「为SSD5课程《数据结构与算法》中的练习」· C++ 代码 · 共 46 行

CPP
46
字号
#include "Client.h"
#include "Date.h"

//Default constructor which initializes the private data members to default values 
Client::Client(void):fname(""),lname(""),email(""),passwd(""){}

//Accepts parameters to initialize the private data members 
Client::Client (string &ifname, string &ilname, string &iemail, string &ipasswd){
	fname=ifname;
	lname=ilname;
	email=iemail;
	passwd=ipasswd;
}

//Makes a copy of a Client object 
Client::Client(Client const &c){
	fname=c.fname;
	lname=c.lname;
	email=c.email;
	passwd=c.passwd;
}

//Accessors and mutators which provide access to the private data members
//Set the value of the private data members 
void Client::setFname(const string&f){fname=f;}
void Client::setLname(const string&l){lname=l;}
void Client::setEmail(const string&e){email=e;}
void Client::setPasswd(const string&p){passwd=p;}

//Return the value of the private data members 
string Client::getFname () const{return fname;}
string Client::getLname () const{return lname;}
string Client::getEmail () const{return email;}
string Client::getPasswd () const{return passwd;} 

//Returns true if the invoking object's password matches the password given in the parameter
bool Client::verifyPasswd(string pass){
	return(passwd==pass);
}

//This method reads a Client object from an input stream
istream &operator>>(istream &stream, Client &c){
	stream>>c.getFname ()>> "\n" >>c.getLname ()>> "\n"
	      >>c.getEmail()>> "\n" >>c.getPasswd()>> "\n";
	return stream;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?