6.3.3 Class methods

Class methods are methods that do not have an instance, but which follow the scoping and inheritance rules of a class. They can be called from inside a regular method, but can also be called using a class identier:

Var  
  AClass : TClass;  
 
begin  
  ..  
  if CompareText(AClass.ClassName,'TCOMPONENT')=0 then  
  ...  

But calling them from an instance is also possible:

Var  
  MyClass : TObject;  
 
begin  
  ..  
  if MyClass.ClassNameis('TCOMPONENT') then  
  ...  

Inside a class method, the self identier points to the VMT table of the class. No elds, properties or regular methods are available inside a class method. Accessing a regular property or method will result in a compiler error. The reverse is possible: a class method can be called from a regular method.

Note that class methods can be virtual, and can be overridden.

Class methods cannot be used as read or write speciers for a property.