类函数\类过程. 它们是直接操作在类上面(没有实例化的对象) 下面是Delphi Help 的描述A class method is a method (other than a constructor) that operates on classes instead of objects. The definition of a class method must begin with the reserved word class. For example,type TFigure = class public class function Supports(Operation: string): Boolean; virtual; class procedure GetInfo(var Info: TFigureInfo); virtual; ... end;The defining declaration of a class method must also begin with class. For example,class procedure TFigure.GetInfo(var Info: TFigureInfo); begin ... end;In the defining declaration of a class method, the identifier Self represents the class where the method is called (which could be a descendant of the class in which it is defined). If the method is called in the class C, then Self is of the type class of C. Thus you cannot use Self to access fields, properties, and normal (object) methods, but you can use it to call constructors and other class methods.A class method can be called through a class reference or an object reference. When it is called through an object reference, the class of the object becomes the value of Self.
就是C++里面用static 得函数
它们是直接操作在类上面(没有实例化的对象)
下面是Delphi Help 的描述A class method is a method (other than a constructor) that operates on classes instead of objects. The definition of a class method must begin with the reserved word
class. For example,type
TFigure = class
public
class function Supports(Operation: string): Boolean; virtual;
class procedure GetInfo(var Info: TFigureInfo); virtual;
...
end;The defining declaration of a class method must also begin with class. For example,class procedure TFigure.GetInfo(var Info: TFigureInfo);
begin
...
end;In the defining declaration of a class method, the identifier Self represents the class where the method is called (which could be a descendant of the class in which it is defined). If the method is called in the class C, then Self is of the type class of C. Thus you cannot use Self to access fields, properties, and normal (object) methods, but you can use it to call constructors and other class methods.A class method can be called through a class reference or an object reference. When it is called through an object reference, the class of the object becomes the value of Self.