In what instances you will declare a constructor to be private ?

 Posted by Bharathi Cherukuri on 6/5/2012 | Category: ASP.NET Interview questions | Views: 4972 | Points: 40
Answer:

When we create a private constructor, we cannot create object of the class directly from a client. Therefore, you will use private constructors when you do not want instances of the class to be created by any external client.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Akiii on: 6/6/2012 | Points: 10
Its a very good point. but can you tell me one more thing related to your question.

What is the use or significance of a class if it cannot be instantiated ?


Thanks and Regards
Akiii

Login to post response