Differences Between Singleton Pattern and Static Type

2020年5月7日 18点热度 0人点赞 0条评论
内容目录
  • The static class constructor cannot have access modifiers, cannot be called externally, and has no parameters;
  • The static class constructor is triggered before creating the first instance or calling the first member;
  • A static class cannot be inherited;

On the other hand, the singleton pattern is an ordinary type that can be instantiated and can have multiple constructors; it can also be inherited;

痴者工良

高级程序员劝退师

文章评论