-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomer.h
More file actions
71 lines (45 loc) · 1.63 KB
/
customer.h
File metadata and controls
71 lines (45 loc) · 1.63 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <string>
#include <vector>
#include "basket.h"
#include "ordered_books.h"
#include "utils.h"
#include "person.h"
using namespace std;
//Class Customer - inherits from class Person
//Contains private variables: money, basket, ordered_books, preferences
class Customer : public Person {
public:
Customer(string name, string surname, unsigned int cardId, double money);
Customer() = default;;
~Customer() override = default;
//getters for variables
double get_money() const { return money; }
Basket &get_basket() { return basket; }
OrderedBooks &get_ordered() { return ordered_books; }
const vector<string> &get_preferences() const { return preferences; }
//methods to add or remove specified elements from collection
void add_preference(string preference);
bool remove_preference(string preference);
void add_to_basket(Book &book);
void remove_from_basket(int book_id);
void add_to_ordered_books(Book &book);
void remove_from_ordered_books(int book_id);
//methods to get string from objects
string to_string() const override;
string preferences_to_string() const;
//method to set variable
void set_money(double new_money) { money = new_money; };
//operators overloading
friend bool operator==(const Customer &c1, const Customer &c2);
friend bool operator!=(const Customer &c1, const Customer &c2);
friend ostream &operator<<(ostream &os, const Customer &dt);
Customer &operator=(const Customer &c);
private:
double money{};
Basket basket;
OrderedBooks ordered_books;
vector<string> preferences;
};
#endif