RAD Studio
ContentsIndex
PreviousUpNext
The Read Method

The read method for a property is a function that takes no parameters (except as noted below) and returns a value of the same type as the property. By convention, the function's name is Get followed by the name of the property. For example, the read method for a property called Count would be GetCount. The read method manipulates the internal storage data as needed to produce the value of the property in the appropriate type. 

The only exceptions to the no-parameters rule are for array properties and properties that use index specifiers (see Creating array properties), both of which pass their index values as parameters. (Use index specifiers to create a single read method that is shared by several properties. For more information about index specifiers, see the Delphi Language Guide.) 

If you do not declare a read method, the property is write-only. Write-only properties are seldom used.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!