If a class contains only static members, remember to mark the class as static or seal the class (NotInheritable) and give the class a private constructor to avoid instance creation.
如果类只包含静态成员,则要记得将该类标记为静态,或者密封该类(NotInheritable),并且还要为该类提供一个私有构造函数,以避免实例创建。
A private constructor is a special instance constructor.
私有构造函数是一种特殊的实例构造函数。
Do classes that should not be instantiated have a private constructor?
不需要实例化的类有私有构造函数吗?
Do classes that should not be instantiated have a private constructor?
不需要实例化的类有私有构造函数吗?
应用推荐