Declaration and definition

Top  Previous  Next

What is translated > Routines > Declaration and definition

 

Routines may be declared first in the interface part of a unit and defined later in the implementation part. If a routine is the member of a class, the declaration always has to be separated from the definition.

 

interface

 

type

  TFoo = class

  private

    procedure foo;

  end;

 

  procedure foo;

 

implementation

 

  

procedure TFoo.foo;

begin

  ...

end;

 

procedure foo;

begin

  ...

end;

 

 

In C# this difference doesn't exist, there is only one place for a routine.

 

public class TFoo : TObject

{

  private void foo()

  {

    ...

  }

 

  public TFoo() {}

};

 

public class ...Class

{

  public static void foo()

  {

    ...

  }

 

} // ...Class

 

Member routines are written inside of the class definition and free routines become public static members of the extra class which is created for each unit.

 

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content