在类定义时在方法前加上class代表什么意思?有加class和没加class有何区别?
类定义如下:
   type 
   tlong=class
     i:integer;
     class procedure cs();
   end;
   class procedure tlong.cs();
   begin
   end;

解决方案 »

  1.   

    有class表示是类方法,是这个类拥有的,而非类的实例所拥有,如create就是
    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.
    类似于c++类的静态函数
      

  2.   

    可以这么简单理解加了Class的方法里面是没有数据成员的,所有类的实例创建与否都能调用