Declaring and defining properties
Declaring a property before you define it allows you to refer to that property before you actually define it.
The syntax for declaring a property is:
Declare [ Static ] [ Public | Private ] Property Set propertyName [ As dataType ]
and
Declare [ Static ] [ Public | Private ] Property Get propertyName [ As dataType ]
The syntax for defining a property is:
[ Static ] [ Public | Private ] Property Set propertyName [ As dataType ]
statements
End Property
and
[ Static ] [ Public | Private ] Property Get propertyName [ As dataType ]
statements
End Property
Element |
Description |
---|---|
Static |
Declares variables defined within the property to be static by default. Static variables retain their values (rather than going out of existence) between calls to the property while the module in which the property is defined remains loaded. |
Public, Private |
When you declare a property at module level, Public lets the application refer to the property outside the module in which it is defined, as long as that module is loaded. Private means the property is available only within the module in which it is defined. When you declare a property inside the definition of a user-defined class, Public means that the property is available outside the class definition; and Private means that the property is only available within the class definition. By default, properties defined at module level are Private, and properties defined within a class are Public. |
propertyName |
The name of the property, which can end in a LotusScript® data type suffix (%, &, !, #, @, and $). These determine the data type of the property's return value. You can append a data type suffix when you declare the property only if you do not include the As dataType clause in the declaration. |
As dataType |
Specifies the data type of the property's return value. A property can return a scalar value, a Variant, or an object reference. If you include this clause, propertyName cannot end in a data type suffix character. If you omit this clause and propertyName doesn't end in a data type suffix character (and isn't covered by an existing Deftype statement), the property's return value is Variant. |
When you define a property, the signatures of the Property Set and Property Get statements must agree as to scope, lifetime of variables, name, and data type.