Delphi Error – E2562 Field identifier required

Delphi Compiler Error

E2562 Field identifier required

Reason for the Error & Solution

This occurs when defining a property on a class member that is not a field.

program E2562;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  TRec = record
    F: Integer;
    function Func1: Integer;
  end;

function TRec.Func1: Integer;
begin
  Result := F;
end;

type
  TClass = class
  private
    Field: TRec;
  public
    property Prop: String read Field.Func1;//E2562
  end;

begin
end.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...