Ritesh Singh
Use of private Constructor in Singleton Design pattern.
By Ritesh Singh in .NET on Aug 22 2017
  • Tushar Dikshit
    Dec, 2017 29

    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

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS