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
Can we set image Source dynamically using C# in WPF application?
What are the different types of delegates?
Explain async and await?
Why use a singleton instead of static methods?
write program in c# using this instructions name avinash varma ,work experiance<2,nochildren his work experiance is higher than 5 years,more than one children one children name is diwakar,number of years of work eperiance at current company is the ratio of children and work experiance is 0.21 to 0.5
What is thread life cycle in c#?
Which of these statements correctly declares a two-dimensional array in c#?
Can enum have methods c#?
What is boxing & unboxing?
What is private static in c#?
In which order the constructor is called for an inherited class?
What is iformatprovider in c#?
What does type safety mean?
Why do canadians say zed?
What is private constructor c#?