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

Answer Posted / nevin jain

In singleton pattern we make the class sealed n keep
contractor as protected
......which is same as keeping class with any access
modifier with private constructor..

both pattern is the example of singleton pattern..
basically this pattern say that only single instance can be
created of the class which can be achieved either by private
constructor or sealed class with protected constructor..

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by generics in c#?

469


What is the benefit of dependency injection c#?

464


Why data types are important?

505


What is wpf c#?

474


What is the best dependency injection c#?

448






What is response redirect in c#?

460


What is the usage of transponders?

520


What are properties in c#. Explain with an example?

452


Why delegate is used in c#?

454


What can I create with c#?

475


What are escape sequences explain with example?

458


Why is dll used?

570


What is yield return in c#?

481


Define delegate in c#?

524


What are the different types of delegation?

427