__published (C++)

From RAD Studio
Jump to: navigation, search

Go Up to C++ Keyword Extensions


Category

Keyword Extensions

Syntax

__published: <declarations>

Description

The __published keyword was added to support the VCL.

The __published keyword specifies that properties in that section are displayed in the Object Inspector, if the class is on the Component palette. Only classes derived from TObject can have __published sections.

The visibility rules for published members are identical to those of public members. The only difference between published and public members is that Delphi-style run-time type information (RTTI) is generated for data members and properties declared in a __published section. RTTI enables an application to dynamically query the data members, member functions, and properties of an otherwise unknown class type.

Note: Properties, Pascal intrinsic or library-derived data members, member functions, and closures are allowed in a __published section. Fields defined in a __published section must be of a class type. Properties defined in a __published section cannot be array properties. The type of a property defined in a __published section must be an ordinal type, a real type, a string type, a small set type, a class type, or a method pointer type.
Attention: When declaring closures with constants and pointers in the published section of a class, use a typedef for the pointer as follows:
 typedef int*
 typedef void _fastcall (_closure MyClosure)(const IntPtr piVal);

See Also