摘要:意图:保证一个类仅有一个实例,并提供一个访问的全局访问点--------------------singleton.h-----------------------View Code #ifndef SINGLETON_H#define SINGLETON_Hclass singleton{public: static singleton* instance();protected: singleton();private: static singleton* _instance;};#endif //SINGLETON_H---------------------singleton.cpp-
阅读全文
随笔分类 - 设计模式

浙公网安备 33010602011771号