-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflyweight.cpp
More file actions
30 lines (29 loc) · 877 Bytes
/
flyweight.cpp
File metadata and controls
30 lines (29 loc) · 877 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
#include "flyweight.h"
void add_car_to_police_data(flyweight_factory& ff, const string& plates, const string& owner, const string& brand, const string& model, const string& color)
{
cout << "\nclient : adding a car to data." << endl;
const flyweight& fly = ff.getflyweight({ brand, model, color });
fly.Operation({ owner, plates });
}
//int main()
//{
// flyweight_factory* _factory = new flyweight_factory({ {"chevrolet", "camaro2020", "pink"}, {"Mercedes benz", "c300", "black"}, {"Mercedes benz", "c500", "red"}, {"BMW", "M5", "red"}, {"BMS", "X6", "white"}});
// _factory->list_flyweight();
//
// add_car_to_police_data(*_factory,
// "CL234IR",
// "James Doe",
// "BMW",
// "M5",
// "red");
//
// add_car_to_police_data(*_factory,
// "CL234IR",
// "James Doe",
// "BMW",
// "X1",
// "red");
// _factory->list_flyweight();
// delete _factory;
// return 0;
//}