1
Reply

Use of private Constructor in Singleton Design pattern.

Ritesh Singh

Ritesh Singh

7y
325
0
Reply

    Singleton pattern implies that you have one active instance of a class all the time. To achieve singleton pattern you can use private constructor. Private constructor prevents inheritance i.e. class cannot be inherited. It also prevents other classes to instantiate the class.In depth reading - http://csharpindepth.com/Articles/General/Singleton.aspx https://stackoverflow.com/questions/2585836/why-do-we-need-a-private-constructor