Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Singleton Design pattern?

design Pattern singleton
0
Posted

Singleton Design pattern?

0

It ensures that a class has only one instance, and provides a global point of access to it. This pattern makes the class itself responsible for creating only one instanceof it. class Singleton { private : static Singleton * pSingleInst; protected : Singleton(); Singleton(const Singleton&); public : static Singleton* getInstance(); } When the static function is called for the first time it creates the instance. Thereon for every subsequent invocation this method will merely return that object again and again.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123