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
Define a jagged array in c#?
What is int64 in c#?
Is it possible to have a static indexer in c#? Allowed in c#.
What is the difference between static class and singleton class in c#?
What are examples of desktop applications?
Is c# 8 released?
How many kinds of elements an array can have?
Write a program to find the angle between the hours and minutes in a clock
What is use of a HashTable in .NET?
What is get set in c#?
What is the difference between protected and private?
Are cao stateful in nature?
Is c and c# the same?
Why delegates are type safe?
What is yield in c#?