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
How does split work in c#?
What is difference between property and variable in c#?
What is static and use of it?
How long does it take to learn c# for unity?
What is a clr (common language runtime)?
What is double c#?
Is there regular expression (regex) support available to c# developers?
Explain About multi level and multiple inheritance how to achieve in .net
What is winforms c#?
What is different between Boxing and Unboxing?
What is lazy loading and eager loading in c#?
What are tuples c#?
What is difference between constants and read-only?
Explain the process of Serialization?
What is the use of convert toint32 in c#?