Since FPC 2.6 class fields can be declared this way (
as documented in this wiki page):
type
TSomeClass = class
public
class var
FSomeClassVar: TSomeType;
end;
In this example variable FSomeClassVar is allocated globally (just one variable exists per class, not per class instance), and it can be accessed through class name (TSomeClass.FSomeClassVar).
In
fpc documentation, I didn't find anything about these class variables.
However, in Reference guide, I found about
static fields. Although Reference guide mentions these in chapter about old tp style objects, I tried and this syntax works in classes.
My question is - are there any differences between these two? Are these static fields and class vars actually same thing?