CPlusPlusThings/design_pattern/singleton/static_local_singleton.cpp
Light-City 60af6600e4 update
2020-02-07 13:42:44 +08:00

23 lines
269 B
C++

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