[fpc-pascal] class constants

Peter Vreman peter at freepascal.org
Fri Jan 25 12:30:56 CET 2008


> Regarding class constants: I missed them, too, already, although not too
> much. ;)

Maybe you should read the documentation. Static fields are supported already for 10 years:

~/fpc/compiler>>> cat p.pp
{$mode objfpc}
{$static on}
type
  cl=class
    l : longint;static;
  end;
var
  c1,c2 : cl;
begin
  c1:=cl.create;
  c2:=cl.create;
  c1.l:=2;
  writeln(c2.l);
  c2.l:=3;
  writeln(c1.l);
end.
[pvreman at goofy]
~/fpc/compiler>>> ./p
2
3
[pvreman at goofy]
~/fpc/compiler>>>





More information about the fpc-pascal mailing list