27 lines
325 B
C++
27 lines
325 B
C++
//
|
|
// Created by dongl on 22-9-26.
|
|
//
|
|
|
|
#ifndef MSTL_SINGLETON_H
|
|
#define MSTL_SINGLETON_H
|
|
|
|
#endif //MSTL_SINGLETON_H
|
|
|
|
|
|
/// 设计模式 单链 单体 单键
|
|
class A{
|
|
public:
|
|
static A& getInstance();
|
|
void setup(){
|
|
|
|
}
|
|
private:
|
|
A();
|
|
A(const A& rhs);
|
|
};
|
|
|
|
A& A::getInstance() {
|
|
static A a;
|
|
return a;
|
|
}
|