A class whose number of instance that can be instantiated is limited to one is called a Singleton class.that means at any given time only one instance exist.
Class Singleton
{
private:
static bool bFlag;
static Singleton *Single;
Singleton()
{
}
public:
static Singleton * getInstance();
void method();
~Singelton()
{
bflag=false;
}
};
bool Singleton: :
Singleton Singleton: :
Class Singleton
{
private:
static bool bFlag;
static Singleton *Single;
Singleton()
{
}
public:
static Singleton * getInstance();
void method();
~Singelton()
{
bflag=false;
}
};
bool Singleton: :
Singleton Singleton: :
Comments
Post a Comment