#include <iostream>
using namespace std;
//
class CSinglton
{
public:
static CSinglton* GetInstance()
{
if(NULL == m_pInstance)
m_pInstance = new CSinglton();
return m_pInstance;
}
static void DoWork() { cout<<"Singlton."<<endl; }
private:
CSinglton() { }
static CSinglton *m_pInstance;
};
CSinglton* CSinglton::m_pInstance = NULL;
//
void main()
{
CSinglton *pInstance = CSinglton::GetInstance();
pInstance->DoWork();
delete pInstance;
}