You define a property in the same way that you define a variable, except that you use the keyword property. In addition, you specify the get and set accessors for the property. Optionally, you can customize the behavior of the get() and set() accessor methods.

When you define a property, you specify visibility for the property, and for the get() and set() accessor methods. The visibility for get() and set() must be the same or more restrictive than the visibility for the property.

Note: You must define get() before set(), otherwise your code will not compile.

Here is the simplified syntax for defining a property:

 define[<visibility>] property <property-name> as 
   <type-name> [no-undo]
 <visibility> get 
   [(): <body of get that returns property> end get].
 <visibility>] set 
   [(<parameter>): <body of set that sets property> end set]. 

Syntax Element

Description

visibility

Public, package-protected, protected, package-private, or private.

property-name

The name of the data member.

type-name

A built-in ABL type or a user-defined type.

parameter

The value that is used to set the property. It must match the type of the property.

See also: