Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
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
#include <memory>
class NetworkManager
{
public:
NetworkManager();
~NetworkManager();
void Connect();
void Disconnect();
private:
class NetManImpl;
std::unique_ptr<NetManImpl> m_pImpl;
};
#include <iostream>
class NetworkManager::NetManImpl
{
public:
~NetManImpl()
{
if (m_connectionOpened)
Disconnect();
}
void Connect()
{
m_connectionOpened = true;
std::cout << "NetManImpl::Connect\n";
}
void Disconnect()
{
m_connectionOpened = false;
std::cout << "NetManImpl::Disconnect\n";
}
private:
bool m_connectionOpened { false };
};
NetworkManager::NetworkManager() : m_pImpl(new NetManImpl())
{
}
NetworkManager::~NetworkManager() = default;
void NetworkManager::Connect()
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content