Class fields (also called static fields) are not documented.
Original Reporter info from Mantis: zoran
-
Reporter name: Zoran Vučenović
Original Reporter info from Mantis: zoran
- Reporter name: Zoran Vučenović
Description:
Since FPC 2.6 class fields can be declared this way (as documented in wiki - http://wiki.freepascal.org/extended_class_syntax):
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.
There is another way to declare class (also called static) fields - using static modifier. This is also undocumented. Although these are mentioned in reference guide (see: http://www.freepascal.org/docs-html/ref/refse27.html), it is only in chapter which explains old (TP) style objects, but not in chapter about classes (although they work in classes).
Additional information:
Please take a look at this forum topic: http://forum.lazarus.freepascal.org/index.php/topic,23683.0.html
Mantis conversion info:
- Mantis ID: 25786
- Fixed in version: 3.0.0
- Fixed in revision: 1096 (#3ba81779)
- Target version: 3.0.0