Reputation: 23
Is it necessary for instance of singleton design pattern to be private or public to be considered a singleton design pattern . for example
class Singleton { public static Singleton obj;
is the access modifier neccessary. What difference does it make.
Upvotes: 1
Views: 196
Reputation: 1
In my view it's necessary for the instance of a singleton design pattern to be private, because somebody may Singleton.obj when it's not be initialized, it is dangerous
Upvotes: 0