Overview
Features
Download
Documentation
Community
Add-Ons & Services

[Stupid question] On singleton holder

A general discussion forum.

[Stupid question] On singleton holder

Postby atticmusic » 08 Aug 2012, 06:55

A stupid question.

In the singleton document,

Code: Select all
#include "Poco/SingletonHolder.h"
class MySingleton
{
public:
   MySingleton()
   {
      // ...
   }
   ~MySingleton()
   {
      // ...
   }
   // ...
   static MySingleton& instance()
   {
      static Poco::SingletonHolder<MySingleton> sh;
      return *sh.get();
   }
};


Cuz we cannot make the constructor and destructor private or protected,
doesn't it make it useless because we can still instantiate more than one instances from the class?

Thanks.
atticmusic
 
Posts: 2
Joined: 08 Aug 2012, 06:45

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron