-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
70 lines (53 loc) · 1.69 KB
/
main.cpp
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
//
// Created by hussein on 8/2/22.
//
#include<iostream>
#include<vector>
using namespace std;
#include"customer.h"
#include"usr_mgr.h"
#include"customer_view.h"
class ExpediaFrontend {
private:
UsersManager* users_manager;
ExpediaBackend* expedia_manager;
CustomerManager* customer_manager = nullptr;
void LoadDatabase() {
users_manager->LoadDatabase();
}
public:
// prevent copy constructor and assignment operator
ExpediaFrontend(const ExpediaFrontend&) = delete;
void operator=(const ExpediaFrontend&) = delete;
ExpediaFrontend() : users_manager(new UsersManager()), expedia_manager(new ExpediaBackend()){
}
~ExpediaFrontend() {
cout << "Destructor: ExpediaFrontend\n";
if (users_manager != nullptr) {
delete users_manager;
users_manager = nullptr;
}
}
void Run() {
LoadDatabase();
while (true) {
users_manager->AccessSystem(); // login/signup
// the code focus on the customer view only
if(users_manager->GetCurrentUser()->GetType() == UserType::CustomerUser) {
customer_manager = new CustomerManager(users_manager->GetCurrentUser(), *expedia_manager);
CustomerView view(*customer_manager);
view.Display();
} else
assert(false);
}
}
};
// TODO Add more flight classes + later operator overloading something + Simulators + logging + integration/unit test + its exception hierarchy
// Singleton loading DB config for flights
int main() {
ExpediaFrontend site;
site.Run();
User* user = new Customer();
dynamic_cast<Customer*>(user);
return 0;
}