Singleton design pattern says that we should define a private static attribute in the "single instance" class. However there was no proper explanation why the data member has to be private static. Will it make any difference if the data member is just private?
In the following code:
class Singleton
{
public:
static Singleton* getInstance();
private:
Singleton(){/*Private constructor*/}
~Singleton(){/*Private destructor*/}
static Singleton * instance; //Why static is required?
};
Will it make any difference if the data member instance
is not static?
EDIT: By putting the destructor in public, will it change the property of singleton design?