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

📄 client.cpp

📁 数据结构 ssd5 ex1
💻 CPP
字号:
#include "Client.h"
//Default constructor Initializes the private data members to default values 
Client::Client(void)
{
	fname = "";//frist name
    lname = "";//last name
    email = "";//email of client
    passwd = "";//password of client
}

//copy constructor
Client::Client(Client const &c)
{
	this->fname=c.fname;
	this->lname=c.lname;
	this->email=c.email;
	this->passwd=c.passwd;
}
//constructor  set private data members   
Client::Client (string &fname, string &lname, string &email, string &passwd)
{
	this->fname=fname;
	this->lname=lname;
	this->email=email;
	this->passwd=passwd;
}

//set the private data members 
void Client::setFname(const string& c)
{
	this->fname=c;
}

void Client::setLname(const string& c)
{
	this->lname=c;	
}

void Client::setEmail(const string& c)
{
	this->email=c;
}

void Client::setPasswd(const string& c)
{
	this->passwd=c;
}
//return 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, false if otherwise
bool Client::verifyPasswd(string passwd)
{
	if(this->passwd==passwd)
		return 1;
	else
		return 0;
}
//over loading operator>> reads a Client object from an input stream
istream &operator>>(istream &is, Client &c)
{
	string t;
	is >> t;
	c.setFname(t);

	is >> t;
	c.setLname(t);

	is >> t;
	c.setEmail(t);

	is >> t;
	c.setPasswd(t);

	return is;
}

⌨️ 快捷键说明

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