class methods

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Class > class methods

Delphi class methods are similar to C# static methods, but they are not identical.

 

The most important differences are:

 

Delphi class methods can be virtual, whereas C# static methods cannot be virtual in the same way.
Delphi class methods have an implicit class reference. They can be called through a class type, a class-reference variable, or even through an object instance, and inside the method Self represents the class on which the method was invoked. C# static methods have no this value and therefore no direct equivalent to this Delphi class-method Self.

 

 

For this reason Delphi2C# distinguishes between:

 

non virtual class methods

virtual class methods

class-method calls that depend on Delphi's implicit Self

 

 

Delphi2C# uses the runtime metaclass type TClass to represent Delphi class references and to support virtual class-method dispatch where required.

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content