there is no restriction at all, you can create n no of objects. A member function can call a private constructor any number of times.
Just 1 single object is created bcoz this is the property of singleton class. A singleton class is a class which ensures the class has only one instance & it provides a global point of access to it. that it provides through a public static member function. This member function when invoked , first checks if the single instance has already been create, if yes it doesn't create a new 1, it gives you back the already created one, so even if you call it multiple times, you get the same object. nd thatz basically the intent behind. If you want to have more than one objects, you can modify this member function & can do that. On Mon, Sep 5, 2011 at 12:45 PM, Neha Singh <neha.ndelhi.1...@gmail.com>wrote: > Guys hv a doubt, plz clarify .. > You mentioned that if a class has a private constructor then the object of > that class can be created using call to a static method which internally > calls the constructor and returns its reference. I can't understand why only > 1 object can be created as mentioned by you. As in, we can call the static > method multiple times and create multiple objects.. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.