If you want to maintain a single instance of a variable for all instances of a class, you will use static-class member variables to do it.
如果您想为一个类的所有实例维持一个变量的实例,将会用到静态类成员变量。
I've made the number a member variable within the Classifier2 class, which allows me to avoid passing it around as a parameter to a bunch of static methods.
我把数字变成是Classifier 2类中的成员变量,这将允许我避免将其作为参数传递给一大堆静态方法。
This is a static member that is invoked directly without creating an instance of its class.
这是静态的成员,可以直接叫用而不需要建立其类别的执行个体。
应用推荐