Internal Data Storage
Go Up to Defining Properties
There are no restrictions on how you store the data for a property. In general, however, Delphi components follow these conventions:
- Property data is stored in class fields.
- The fields used to store property data are private and should be accessed only from within the component itself. Derived components should use the inherited property; they do not need direct access to the internal data storage of the property.
- Identifiers for these fields consist of the letter F followed by the name of the property. For example, the raw data for the Width property defined in TControl is stored in a field called FWidth.
The principle that underlies these conventions is that only the implementation methods for a property should access the data behind it. If a method or another property needs to change that data, it should do so through the property, not by direct access to the stored data. This ensures that the implementation of an inherited property can change without invalidating derived components.