Delphi Compiler Error
E2169 Field definition not allowed after methods or properties
Reason for the Error & Solution
You have attempted to add more fields to a class after the first method or property declaration has been encountered. You must place all field definitions before methods and properties.
program Produce; type Base = class procedure FirstMethod; a : Integer; end; procedure Base.FirstMethod; begin end; begin end.
The declaration of ‘a’ after ‘FirstMethod’ will cause an error.
program Solve; type Base = class a : Integer; procedure FirstMethod; end; procedure Base.FirstMethod; begin end; begin end.
To solve this error, it is normally sufficient to move all field definitions before the first field or property declaration.