A getter is declared using a property get declaration. A property get declaration consists of the keyword Get
followed by a block. Given a property named P
, a getter declaration implicitly declares a method with the name get_P
with the same modifiers, type and parameter list as the property. If the type contains a declaration with that name, an error results.
A special local is implicitly declared in the getter body's declaration space with the same name as the property representing the return value of the property. The local has special semantics when used in expressions: if the local is used in a non-variable expression, then the name will bind to the property rather than to the local. For example, given a property P
, the expression P = 1
references the property return local, while x = P
is a recursive load of P
. When control flow leaves the getter body, the value of the local is passed back to the access expression.
Get
[ Attributes ] LineTerminatorEnd
Get