标签:obj static include let get 创建型 class amp 有一个
保证一个类只有一个实例
# include <iostream> class Singleton { public: static Singleton *GetSingleton() { static Singleton obj; return &obj; } private: Singleton() {} }; int main() { Singleton *obj = Singleton::GetSingleton(); return 0; }
标签:obj static include let get 创建型 class amp 有一个
原文地址:http://www.cnblogs.com/vrg0/p/7479861.html