What is a private constructor? where will you use it?

Answer Posted / saurabh

In singleton pattern the constructor is not private but
protected.

Go for private constructor when your class has methods which
do not require object creation. ex. (Math class in c#).
Like If your class has all static method, you need not to
create an object in that case go for private constructor.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does split work in c#?

472


What is difference between property and variable in c#?

460


What is static and use of it?

457


How long does it take to learn c# for unity?

474


What is a clr (common language runtime)?

473






What is double c#?

520


Is there regular expression (regex) support available to c# developers?

516


Explain About multi level and multiple inheritance how to achieve in .net

563


What is winforms c#?

473


What is different between Boxing and Unboxing?

573


What is lazy loading and eager loading in c#?

470


What are tuples c#?

491


What is difference between constants and read-only?

433


Explain the process of Serialization?

534


What is the use of convert toint32 in c#?

515