Original Post
I'm learning C++ and I'm having trouble understanding singleton classes fully. First of all why does it need its instance pointer declared globaly outside of the class before it can be used? example: SingletonExample *SingletonExample::PtrInstance; What does declaring things like this outside the class do? Is it just another form of prototyping? WHY? Second why does it need a normal instance of it created before a pointer to be initialized to it? example: //inside main proc. SingletonExample SingletonInstance; SingletonExample *PtrToSingleton; PtrToSingleton = SingletonExample::GetSingleton(); Wouldn't initializing the pointer create an instance in memory? Or does it need that instance so the constructor can initialize the class by returning itself to it's own pointer? I think I just answered my own question :p But I still need an answer to the first question.