作业:用c++实现singleton模式。具体的该如何下手啊?关于C++多线程的书籍知道的比较好的帮忙推荐一下了。谢谢
C++多线程的书籍推荐台湾侯捷的《Win32 多绪程式设计》
http://www.cnblogs.com/jiese/p/3158517.html
class singleton
{
private: singleton() { } //封闭构造函数
private: static singleton * _instance; // 唯一实例
public: static singleton * getinstance() //通过方法返回这个实例
{
if (null == _instance)
_instance = new singleton();
return _instance;
}
}
http://jjhou.boolan.com/jjtbooks-multithreaded-in-win32.htm
http://www.jb51.net/books/58052.html
c++11的static 方式创建singlton已被支持。me y