Can any one tell me the Singletn Class in brief
Printable View
Can any one tell me the Singletn Class in brief
singleton class is used to restrict instantiation of a class to one object. This is useful when u are sure that one object for a class will improve the performance instead of creating multiple objects for the same class. The singleton class returns the references when the object is already created.
eg: when the organisation has the database which is accessed by all. If every one creates the object for establishing a connection to the database, then it will not be efficient, instead they can make it as singleton which will make use of only one connection. But the singleton class has drawbacks.....
hope this will be helpfull for u.....
Here s a goos intro with code
[url]http://en.wikipedia.org/wiki/Singleton_pattern[/url]