-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.h
45 lines (32 loc) · 917 Bytes
/
Card.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
#ifndef CARD_H
#define CARD_H
#include <stdexcept>
#include <stdlib.h>
#include "helper-functions.hpp"
class Card{
private:
string cardNumber;
string PIN;
//static fields
static const char* CARD_NUM_START;
static const int MIN_CARD_NUM_LEN;
static const int PIN_LEN;
void setCardNumber(const string& cardNumber);
void setPIN(const string& PIN);
friend class Client;
friend class BankDatabase;
public:
Card() = default;
Card(const string& cardNumber, const string& PIN);
string getCardNumber() const;
string getKey() const;
bool validatePIN(const string& PIN) const;
//file input/output
void serialize(std::ofstream& fout) const;
void deserialize(std::istream& fin);
//console output
friend std::ostream& operator<<(std::ostream& out, const Card& card);
//static methods
static string generateRandPIN();
};
#endif