Published properties

[next] [prev] [prev-tail] [tail] [up]

#### 6.7.5 Published properties

Classes compiled in the {$M+} state (such as TPersistent from the classes unit) can have a published section. For methods, fields and properties in the Published section, the compiler generates RTTI information (Run Time Type Information), which can be used to query the defined methods, fields and properties in the published section(s). The typinfo unit contains the necessary routines to query this information, and this unit is used in the streaming system in FPC in the classes unit.

The RTTI is generated regardless of what the read and write specifiers are: fields, functions/procedures or indexed functions/procedures.

Only class-typed fields can be published. For properties, any simple property whose size is less than or equal to a pointer, can be declared published: floats, integers, sets (with less than 32 distinct elements), enumerated, classes or dynamic arrays (not array properties).

Although run-time type information is available for other types, these types cannot be used for a property or field definition in a published section. The information is present to describe for example arguments of procedures or functions.

[next] [prev] [prev-tail] [front] [up]