Sunday, 17 April 2016

How to make Singleton ?


Instead of having a public constructor for our class, we use a private constructor.
Then we use a public static method (usually named getInstance()) to make sure there is only one copy.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.