We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 931fdb5 commit f089700Copy full SHA for f089700
singleton/Singleton.cpp
@@ -28,19 +28,19 @@ class Singleton {
28
std::cout << "This is Singleton." << std::endl;
29
// ...
30
}
31
-
32
33
34
private:
+ Singleton() {}
35
static Singleton *instance;
36
37
};
38
39
+Singleton* Singleton::instance = nullptr;
40
+
41
42
int main()
43
{
- Singleton singleton;
- singleton.tell();
44
+ Singleton::get()->tell();
45
return 0;
46
0 commit comments