when shall i go for a Singleton class?
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, April 10, 2002 04:57 AM

Hi Friends..


I just want to know when i have to go for writing a Singleton class. Can anyone tell me any realtime usage of this concept.Is there any other patterns available like Singleton in the present usage.


Cheers


Chimbu

Re: when shall i go for a Singleton class?

Posted By:   Nir_Sharony  
Posted On:   Thursday, May 16, 2002 03:17 PM

Use the Singleton pattern to control the number of instances a class your application may have.


For instance, it may be desirable and logical for an application to only have a single object that will be in charge of memory management


By making that object a singleton, you force the user to only have one instance of that object (by controling the way the object is created).

Re: when shall i go for a Singleton class?

Posted By:   Anand_Rajasekar  
Posted On:   Thursday, April 11, 2002 04:39 PM

In a nutshell use a singleton class for helper functions and when you need a one place data store.

Re: when shall i go for a Singleton class?

Posted By:   Laurent_Mihalkovic  
Posted On:   Wednesday, April 10, 2002 11:07 AM

have a look at this site

cheers

Re: when shall i go for a Singleton class?

Posted By:   Bozidar_Dangubic  
Posted On:   Wednesday, April 10, 2002 07:24 AM

use singleton when you need singleton. use other patterns when you need them. singleton you use when you need a single instance of a class in the application.
About | Sitemap | Contact