| 
       non virtual class methods  | 
    Top Previous Next | 
| 
 What is translated > Types > Records, Classes, Interfaces > Class > class methods > non virtual class methods Delphi non virtual class methods are converted to C# static methods. They can be called through a class reference or an object reference: 
 
 type TBase = class(TObject) public class function ClassMethod(xi: Integer): Integer; end; 
 ... 
 var pBase: TBase; i : Integer; begin i := TBase.ClassMethod(0); // calling through a class reference // ... i := pBase.ClassMethod(0); // calling through an object reference 
 
 This is translated in the following way: 
 
 public class TBase : TObject { public static int ClassMethod(int xi) { ... 
 }; 
 ... 
 TBase* pBase = NULL; int i = 0; TBase.ClassMethod(0); // calling through a class reference // ... TBase.ClassMethod(0); // calling through an object reference 
 The class method cannot be called through an object reference. 
 
 
 
 
  | 
| 
       This page belongs to the Delphi2C# Documentation  | 
    Delphi2C# home Content |