I implemented the Singleton design pattern in my code.
Suppose it is:
class Singleton
{
Singleton () {}
static Singleton* s;
public:
static Singleton* Get () {
if (!s)
s = new Singleton ();
return s;
}
};
What puzzles me is the 'initialization' of this pattern. In the .cpp I put:
SingletonPointer* SingletonClass::s (0);
But I don't understand how is it possible to access define s
, as it is private
.
How's that possible?
TIA, Jir