Initialization/Finalization

Top  Previous  Next

What is translated > Statements > Initialization/Finalization

 

There isn't any direct counterpart for the sections "initialization" and "finalization" of a Unit in C#. These sections are therefore translated as two functions which contain the respective instructions. In addition, a global variable of a class is defined. In the constructor of this class the initialization routine is called and in destructor the routine for the finalization is called.

 

 

initialization

 

pTest := CTest.Create;

 

finalization

 

pTest.Free();

 

 

->

 

 

void Tests_initialization()

{

  pTest = new CTest;

}

 

void Tests_finalization()

{

  delete pTest;

}

 

class Tests_unit

{

public:

Tests_unit(){ Tests_initialization(); }

~Tests_unit(){ Tests_finalization(); }

};

Tests_unit _Tests_unit;

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content