more operator overloading

Top  Previous  Next

New features since Delphi 7 > Operator Overloading > more operators

 

In Delphi there the operators Round, Trunc and In, which have no counterparts in C++. These operators are defines as static member functions in C++.

 

 

 

/*#static*/ __int64 TMyClass::Round(const TMyClass& Value)

{

  __int64 result = 0;

       result = d2c_system::Round(((double) Value)); // cast to double prevents from cycle

  return result;

}

 

 

At positions, where these operators are used, Delphi2Cpp creates explicit calls to the member function. For example:

 

 

var

  x: TMyClass;

  d : Double;

begin

  d := Round(x);

 

 

becomes to:

 

TMyClass X = {0};

double d = 0.0;

 

d = TMyClass::Round(X);

 

 

New in Delphi 10.4 Sydney are the Initialize and the Finalize operators.

 

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content