Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Only One Object  RSS feed

 
Saurabh Saha
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
how we can create a class that create only one instance of that class.

Thanks
Vivek
 
Sripathi Krishnamurthy
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Such a design pattern is called "Singleton Pattern". To know more about this and all the other design patterns , go here
http://www.allapplabs.com/java_design_patterns/singleton_pattern.htm
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!