How to make class as singleton pattern

Showing Answers 1 - 2 of 2 Answers

ghouse

  • Jan 18th, 2007
 

Singleton class has only one instance, and to provide a global point of access to it.

ex

class Singleton
  {
  public:
      static Singleton* Instance();
  protected:
      Singleton();
      Singleton(const Singleton&);
      Singleton& operator= (const Singleton&);
  private:
      static Singleton* pinstance;
  };

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions