-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProxy.cpp
36 lines (27 loc) · 842 Bytes
/
Proxy.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
//============================================================================
// Name : Proxy.cpp
// Created on : 12.04.2020
// Author : Tokmakov Andrey
// Version : 1.0
// Copyright : Your copyright notice
// Description : Proxy tests
//============================================================================
#include "Proxy.h"
namespace Proxy_Pattern_Tests {
ICar::~ICar() {
std::cout << "ICar destructor!" << std::endl;
}
void Car::DriveCar() noexcept {
std::cout << "Car has been driven!" << std::endl;
}
ProxyCar::ProxyCar(int driver_age) : driver_age_(driver_age) {
}
void ProxyCar::DriveCar() noexcept {
if (this->driver_age_ > 16) {
this->real_car_->DriveCar();
}
else {
std::cout << "Sorry, the driver is too young to drive." << std::endl;
}
}
}