-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCar.cpp
More file actions
43 lines (35 loc) · 850 Bytes
/
Car.cpp
File metadata and controls
43 lines (35 loc) · 850 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
31
32
33
34
35
36
37
38
39
40
41
42
43
// ===========================================================================
// Car.cpp
// ===========================================================================
#include <iostream>
#include <memory>
#include "Engine.h"
#include "Car.h"
class Car::EngineImpl
{
public:
void coolDown()
{
/* ... */
std::cout << "EngineImpl -> cooling down" << std::endl;
}
private:
Engine m_engine;
};
Car::Car()
: m_engineRaw{ new EngineImpl() },
m_engineUnique(std::make_unique<EngineImpl>())
{}
Car::~Car()
{
delete m_engineRaw;
}
void Car::coolDown()
{
m_engineRaw->coolDown();
// oder
m_engineUnique->coolDown();
}
// ===========================================================================
// End-of-File
// ===========================================================================