What do you meant by private constructor? why somebody declare only private constructor.

Questions by Beena   answers by Beena

Showing Answers 1 - 8 of 8 Answers

vijaydogra

  • Sep 18th, 2005
 

One can delcare a private constructor for maintining the object creation ... maybe it just wants the object to be created once .... or maybe using a static method such as getInstance() one can give access to constructor which is private....Basically to control number of objects of classes.Vijay

  Was this answer useful?  Yes

sangeeta

  • Oct 3rd, 2005
 

u can have a single instance of the class at a time. to implement singleton design pattern, u can declare a constructor private.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions