non virtual class methods

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Class > class methods > Other compilers cllass 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:

 

 

class TBase: public TObject {

  static int __fastcall ClassMethod( int xi );

};

 

...

 

TBase* pBase = NULL;

int i = 0;

TBase::ClassMethod(0);  // calling through a class reference

// ...

pBase->ClassMethod(0);  // calling through an object reference

 

 

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content