5.5.1 Declaration

The declaration of a method is much like a normal function or procedure declaration, with some additional specifiers, as can be seen from the following diagram, which is part of the object declaration:


--              --     -----            ---- -              ----
  method definition --class--| - function header --|;  method directives
                          -pcrooncstedruucrteo hre haeadderer-|
                          -destructor header-|

--              -------------------------------------------------
  method directives - virtual- ;---------------| -call modifiers ;-|
                             -abstract -;--|

from the point of view of declarations, Method definitions are normal function or procedure declarations. Contrary to TP and Delphi, fields can be declared after methods in the same block, i.e. the following will generate an error when compiling with Delphi or Turbo Pascal, but not with FPC:

  MyObj = Object  
    Field : Longint;  
    Procedure Doit;