-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.cpp
More file actions
43 lines (33 loc) · 721 Bytes
/
user.cpp
File metadata and controls
43 lines (33 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "user.h"
using namespace std;
User::User() : name_("unknown"), age_(0), balance_(0.0), type_(1), hashed_password(0)
{
}
User::User(std::string name, int age, double balance, int type, int pass) :
name_(name), age_(age), balance_(balance), type_(type), hashed_password(pass)
{
}
User::~User()
{
}
bool User::assertPass(int x){return x == hashed_password;}
int User::getAge() const
{
return age_;
}
std::string User::getName() const
{
return name_;
}
double User::getBalance() const
{
return balance_;
}
void User::deductAmount(double amt)
{
balance_ -= amt;
}
void User::dump(std::ostream& os)
{
os << name_ << " " << age_ << " " << balance_ << " " << type_ <<" "<<hashed_password<<endl;
}