[fpc-pascal] Const attributes

Marcos Douglas B. Santos md at delfire.net
Sun Jul 30 18:37:57 CEST 2017


The following code is compilable.
I'm using a private const with type defined and I can change it in the
constructor.

1. Is this by design?
2. Is there a way to declare attributes "final" like Java does?

=== begin ===
type
  TFoo = class
  private
    const INT: Integer = 0;
  public
    constructor Create;
  end;

implementation

constructor TFoo.Create;
begin
  INT := 9;
end;

end.
=== end ===

Best regards,
Marcos Douglas



More information about the fpc-pascal mailing list