-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (28 loc) · 1.09 KB
/
main.cpp
File metadata and controls
42 lines (28 loc) · 1.09 KB
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
//
// main.cpp
// ThreadSafeSingleton
//
// Created by guowei on 13/10/2016.
// Copyright © 2016 guowei. All rights reserved.
//
#include <iostream>
#include "TestClass.hpp"
#include "ThreadSafeSingleton.hpp"
int main(int argc, const char * argv[]) {
// insert code here...
/*TestClass *a = new TestClass();
std::cout << "Instance Number = " << TestClass::getInstanceNumber() << std::endl;
TestClass *b = new TestClass();
std::cout << "Instance Number = " << TestClass::getInstanceNumber() << std::endl;
delete a;
a = NULL;
std::cout << "Instance Number = " << TestClass::getInstanceNumber() << std::endl;
delete b;
b = NULL;
std::cout << "Instance Number = " << TestClass::getInstanceNumber() << std::endl;*/
TestClass *c = Singleton<TestClass>::getInstance();
std::cout << "Instance Number = " << TestClass::getInstanceNumber() << std::endl;
TestClass *d = Singleton<TestClass>::getInstance();
std::cout << "Instance Number = " << TestClass::getInstanceNumber() << std::endl;
return 0;
}