class Single_Instance{
public:
Single_Instance * Get_Instance();
private:
Single_Instance * pCur_Instance;
int data;
Single_Instance();
Single_Instance(Single_Instance & copy);
~Single_Instance();
};
Single_Instance::Single_Instance()
{
cout<<"new single!"<<endl;
}
Single_Instance::Single_Instance(Single_Instance & copy)
{
cout<<"new single by copy!"<<endl;
}
Single_Instance::~Single_Instance()
{
cout<<"destroy single!"<<endl;
}
Single_Instance * Single_Instance::Get_Instance()
{
if(pCur_Instance==NULL)
pCur_Instance = new Single_Instance;
return pCur_Instance;
}
}