-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank.h
executable file
·53 lines (45 loc) · 1.49 KB
/
Bank.h
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
44
45
46
47
48
49
50
51
52
53
#pragma once
#include "Account.h"
#include "Transfer.h"
#include "Money.h"
#include "MoneyDisposal.h"
#include <vector>
using namespace std;
class Bank
{
private:
static Bank *_self;
vector<Account*> _accounts;
const Account& addToBalance(const Money&, Account&);
const Account& removeFromBalance(const Money&, Account&);
static vector<Account*> getUsers();
// No copying constructor for bank.
Bank(Bank&);
bool updateAccounts();
protected:
~Bank();
public:
const unsigned int _commissionWithdrawal;
const unsigned int _commissionTransfer;
const unsigned int _commissionMobileReplenishment;
Bank(vector<Account*>);
static Bank* getBank();
void free();
bool transfer(Transfer&);
bool checkIsEnough(const Account&, const Money&);
bool withdraw(Account&, const Money&);
//bool withdraw(const Account&, const MoneyDisposal&);
bool changePIN(Account*, const string&, const string&);
bool changePhone(Account*, const string&, const string&);
bool replenishPhone(Account*, const string&, const Money&);
void blockAccount(const string&);
Account* getAccount(const string&, const string&);
// Very bad decision
Account* getAccount(const string&);
Account* addAccount(string card, string name, string phone, string pwd,
unsigned long long balance = 0, bool blocked = false);
// Delete this. Created for the sake of testing.
void pseudoAdd(Money amount, Account& acc){
*acc._balance += amount;
}
};