C++ (Qt)MySingle * MySingle::mInstance = 0; MySingle * MySingle::Instance( void ){ static QMutex mutex; if (!mInstance) { QMutexlocker lock(&mutex); mInstance = new MySingle; } return mInstance;}
QScopedPointer<MySingle> MySingle::m_instance(new MySingle());MySingle *MySingle::instance() { return m_instance.data();}