⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.cpp

📁 ssd5 exercise1答案
💻 CPP
字号:
/*
* Author: Ma Yaowen
* Version:1.0.0
*/
#include "Client.h"
//default constructor for Client
Client::Client(void):fname(""),lname(""),email(""),passwd(){}
//copy constructor for Client
Client::Client(Client const &c){
 fname=c.getFname();
 lname=c.getLname();
 email=c.getEmail();
 passwd=c.getPasswd();
}
//constructor with parameters for Client
Client::Client (string &fname, string &lname, string &email, string &passwd){
 
  this->fname=fname;
  this->lname=lname;
  this->email=email;
  this->passwd=passwd;
}
//set name of Client
void Client::setFname(const string& a){
  fname=a;
}
//set lname of Client
void Client::setLname(const string& b){
  lname=b;
}
//set email of Client
void Client::setEmail(const string& c){
 email=c;
}
//set passwd of Client
void Client::setPasswd(const string& d){
 passwd=d;
}
//get fname of Client
string Client::getFname () const{
 return fname;
}
//get lname of Client
string Client::getLname () const{
  return lname;
}
//get email of Client
string Client::getEmail () const{
  return email;
}
//get passwd of Client
string Client::getPasswd () const{
 return passwd;
}
//verify passwd
bool Client::verifyPasswd(string passwd){
  return  this->passwd==passwd;
}

//input an Client object
istream &operator>>(istream &stream, Client &c){
 string t;

 getline(stream,t,'\n');
 c.setFname(t);
  
 getline(stream,t,'\n');
 c.setLname(t);

 getline(stream,t,'\n');
 c.setEmail(t);

 getline(stream,t,'\n');
 c.setPasswd(t);

 return stream;
}

⌨️ 快捷键说明

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