static class and singleton

前端 未结 5 1726
谎友^
谎友^ 2020-12-14 21:04

Isn\'t a class with all static members/methods a kind of singleton design pattern? Is there any disadvantage in particular of having such classes? A detailed explanation wo

5条回答
  •  庸人自扰
    2020-12-14 21:35

    For a singleton all constructors have to be private, so that you can access only through a function. But you're pretty close to it.

提交回复
热议问题