What is singleton design pattern
Answer / lokesh
Singleton design pattern is a a creational pattern to
dictate how and when objects get created and it's main
purpose is to ensure that a class has only one instance
#define NULL 0
Singleton& operator =(Singleton&);
static Singleton* pSingleton;
if(NULL == pSingleton)
pSingleton = new Singleton();
void setValue(int val)
nValue = val;
Singleton* Singleton::pSingleton = NULL;
int main(int argc, char* argv)
Singleton *abc = NULL;
Singleton *xyz = NULL;
Singleton *sss = Singleton::Instance();
|Is This Answer Correct ?||16 Yes||5 No|
Which Design Patterns you know?
What is the difference between builder and composite?
What are the SDLC phases you have invloved ?
What is meant by design pattern?
Give the syntax of css?
What are actually Model,view,Controller in MVC Pattern?
Explain what is good design?
What is lexi design pattern?
What is a lazy initialization in singleton?
What is the creational design pattern?
Shall we use abstract classes or interfaces in policy / strategy design pattern?
what is design patterns? which design patterns mostly used in .net? How it is used with examples?