|  | Posted by Weird-beard on 11/19/05 00:37 
there are situations that you must have an instance, an instance inwhich you can fiddle with class variables. In static functions, you
 cannot change the class variables, as the variables are kept inside the
 instance but you dont have one. And the reason for using singleton is,
 if you need the variable setting but you do not need the object more
 than once and/or the class is expensive to maintain in terms of memory.
 Singleton helps here. (See factory pattern, for example. Factories can
 be driven by static methods too, if you do not need any variable
 settings inside the class.)
  Navigation: [Reply to this message] |