About Store Forum Documentation Contact



Post Reply 
GUI Singleton
Author Message
Kiekos Offline
Member

Post: #16
RE: GUI Singleton
So what's the risk of not making them private?
02-01-2014 08:42 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #17
RE: GUI Singleton
(02-01-2014 08:42 PM)Kiekos Wrote:  So what's the risk of not making them private?

Multiple instances. But the static instance would always remain the same, making the second instance different aside from the static member. Basically, a mess.
02-01-2014 09:07 PM
Find all posts by this user Quote this message in a reply
Kiekos Offline
Member

Post: #18
RE: GUI Singleton
So, having the class declared like this:

Code:
class Debugger
{
public:
    static Debugger& Instance();    
    void myFunction();
    
private:
    Debugger();
    Debugger( Debugger& );
    void operator=(const Debugger&);
};

I can rest assured there's always gonna be only one instance? (from what I've understood)
02-01-2014 11:10 PM
Find all posts by this user Quote this message in a reply
rstralberg Offline
Member

Post: #19
RE: GUI Singleton
Yes
02-01-2014 11:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply