#include<iostream>
using namespace std;
class Simpleton
{
private :
Simpleton() {}
static Simpleton *uniqueInstance;
public :
static Simpleton *getInstance()
{
if(uniqueInstance == NULL)
// {
//uniqueInstance = new Simpleton();
//}
//return uniqueInstance;
return new Simpleton();
}
void show()
{
cout<<"hello Simpleton"<<endl;
}
};
int main()
{
Simpleton *simpl = Simpleton::getInstance();
simpl->show();
return 0;
}
using namespace std;
class Simpleton
{
private :
Simpleton() {}
static Simpleton *uniqueInstance;
public :
static Simpleton *getInstance()
{
if(uniqueInstance == NULL)
// {
//uniqueInstance = new Simpleton();
//}
//return uniqueInstance;
return new Simpleton();
}
void show()
{
cout<<"hello Simpleton"<<endl;
}
};
int main()
{
Simpleton *simpl = Simpleton::getInstance();
simpl->show();
return 0;
}