class A
{
public:
static A* GetInstance()
{
cout<<"A::GetInstance()"<<endl;
if(!a)
{
a=new A;
}
return a;
}
private:
A()
{
cout<<"A-------------"<<endl;
}
public:
static A* a;
};
A* A::a=0;
int main(void)
{
A *a=A::GetInstance();
A *b=A::GetInstance();
A *c=A::GetInstance();
cout<<"a="<<(int)a<<"/nb="<<(int)b<<"/nc="<<(int)c<<endl;
getchar();
}