forked from akhtyamovpavel/PatternsCollection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (33 loc) · 994 Bytes
/
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
//
// Created by Pavel Akhtyamov on 2019-03-26.
//
#include <memory>
#include <Axle.h>
#include <CarAxle.h>
#include <PlaneAxle.h>
#include <Gamepad.h>
#include <PlaneWheel.h>
int main() {
std::unique_ptr<Axle> car_axle = std::make_unique<CarAxle>();
Gamepad gamepad(std::move(car_axle));
gamepad.PressUpButton();
for (size_t index = 0; index < 10; ++index) {
gamepad.PressGasPedal();
gamepad.PressDownButton();
gamepad.PressGasPedal();
}
gamepad.PushWheel();
gamepad.PrintInfo();
std::unique_ptr<Axle> plane_car_axle = std::make_unique<CarAxle>();
PlaneWheel plane_wheel(std::move(plane_car_axle));
for (size_t index = 0; index < 10; ++index) {
plane_wheel.PullWheel();
}
plane_wheel.PrintInfo();
std::unique_ptr<Axle> plane_axle = std::make_unique<PlaneAxle>();
PlaneWheel real_plane_wheel(std::move(plane_axle));
for (size_t index = 0; index < 10; ++index) {
real_plane_wheel.PullWheel();
}
real_plane_wheel.PrintInfo();
}