Virtual class methods as static methods

Top  Previous  Next

User interface > Translation options > Tuning options > Virtual class methods as static methods

Because in C# methods cannot be static and virtual at the same time, Delphi virtual class methods either have to be converted to static non-virtual methods or to virtual non-static methods. This is determined by the tuning option Virtual class methods as static methods, which is set to true by default. This is the best option for the frequent case, that there aren't overridden versions to the method at all. In this case a method like:

 

class procedure ClassVirtual; virtual;

 

simply become a non-virtual static function:

 

static virtual void ClassVirtual();

 

 

If there are overridden Delphi virtual class methods, the option Virtual class methods as static methods has to be disabled. The method then becomes

 

virtual void ClassVirtual(); //#static

 

Delphi2C# then takes care, that the method is called from an ClassRef-instance of the according class. This works only, if the creation of meta-classes is enabled.

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content