Singleton: How should it be used

后端 未结 24 2472
Happy的楠姐
Happy的楠姐 2020-11-22 04:57

Edit: From another question I provided an answer that has links to a lot of questions/answers about singletons: More info about singletons here:

So I have read th

24条回答
  •  情书的邮戳
    2020-11-22 05:12

    Anti-Usage:

    One major problem with excessive singleton usage is that the pattern prevents easy extension and swapping of alternate implementations. The class-name is hard coded wherever the singleton is used.

提交回复
热议问题