CPlusPlusThings/design_pattern/singleton/static_local_singleton.cpp
2022-01-13 10:59:16 +08:00

23 lines
275 B
C++

//
// Created by light on 20-2-7.
//
#include <iostream>
using namespace std;
class singleton {
private:
static singleton *p;
singleton() {}
public:
static singleton &instance();
};
singleton &singleton::instance() {
static singleton p;
return p;
}