CPlusPlusThings/modern_C++_30/memorymodel_atomic/hungrysingleton.cpp
Light-City 60af6600e4 update
2020-02-07 13:42:44 +08:00

18 lines
250 B
C++

//
// Created by light on 20-2-6.
//
class singleton {
private:
singleton() {}
static singleton *p;
public:
static singleton *instance();
};
singleton *singleton::p = new singleton();
singleton* singleton::instance() {
return p;
}