WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
[access] [property_mod ...] PROPERTY name, property_type method_def . . . ENDPROPERTY
or (to declare a simple property)
[access] [property_mod ...] simple_mod PROPERTY name, property_type [,initial_value]
(optional) One of the following access modifiers:
Access is not restricted. This is the most accessible option.
Access is limited to the containing class or types derived from the containing class.
Access is limited to the containing type. This is the least accessible option. (default)
Access is limited to the current assembly. (Synergy .NET only)
Access is limited to the current assembly and types derived from the containing class. (Synergy .NET only)
(optional) One or more of the following property modifiers, with the restrictions stated in the Discussion:
Must have a method implemented in a derived class of the same signature. Subclasses must implement this method.
Cannot be overridden any further by inheriting classes without the NEW modifier.
Hide an inherited member of the same name.
Overrides the parent class’s virtual method that has the same method signature.
Accessed without a reference object. The method can be executed even if the class that contains the method hasn’t been instantiated.
Can be overridden in a subclass.
The name of the property to declare.
Any valid field type. See Defining a field. The only valid array syntax for a property type is [#]@class.
The definition of a get or a set accessor method (METHOD GET or METHOD SET). (See METHOD-ENDMETHOD for more information about defining a method.)
One of the following simple property modifiers:
Generates a public get accessor only.
Generates a public get accessor and a public set accessor.
Generates a public get accessor and a protected set accessor.
Generates a public get accessor and a private set accessor.
Generates a public get accessor and an internal set accessor.
Generates a public get accessor and a protected internal set accessor.
A literal or compile-time expression that the property value will be set to before the first invocation.
A property holds information. It is presented like a variable to a routine using the class in which the property is declared, but a property has code associated with it, like a function.
Although a property appears to look like a field in the code, it isn’t. The compiler translates it into a set of method calls. Because of this, property access is significantly slower than field access, and properties cannot be used in the same places that fields can. For example you can do this:
if (field = 20)
but not this:
if (property = 20)
The access modifier (PUBLIC, PROTECTED, PRIVATE, INTERNAL, or PROTECTED INTERNAL) can appear between the other modifiers; it does not have to come first. See Accessibility for more information about these settings.
By default, properties cannot be overridden unless they are marked as ABSTRACT, OVERRIDE, or VIRTUAL. (ABSTRACT and OVERRIDE properties are also assumed to be virtual and are mutually exclusive.) An ABSTRACT property has no implementation, which means it has a PROC and an END with no intervening statements.
The SEALED modifier can only be specified in conjunction with the OVERRIDE modifier.
If you have any questions about which modifiers can be specified together, see the Exclusivity of METHOD modifiers table.
You can hide a class member in a parent class with an identical signature in an inherited class by specifying a member with the same name, along with the NEW member modifier, within the inheriting class. You can also hide dissimilar members. (For example, a field or a sealed member in the parent can be hidden by a method or field of the same name marked NEW in the child.) The class members can be different kinds (for example, a method and a field).
You can optionally override the property accessibility by declaring an access modifier on the get or set accessor. The modifier on the get or set accessor must be more restrictive than the accessibility of the property itself.
The method_def can be a METHOD GET or METHOD SET definition to get or set the value of the property. (See Examples for an example of each.)
When you declare a set method for a property, an implicit value argument, which has the same type as the property, represents the value to which the property should be set. (Because the keyword value is reserved, it cannot be used as an identifier within a set method.) Parameters are not valid on get or set methods.
To get an accessible property value from an instantiated class, use the following syntax, which causes the property’s declared get method to be executed:
avalue = var1.myproperty
To set an accessible property value from an instantiated class, use the following syntax, which causes the property’s set method to be executed:
var1.myproperty = avalue
You can define a simple, or auto-implemented, property if there’s no need to create a separate field or a get or set method with additional logic. A simple property declaration is more concise, and the compiler automatically creates an implied backing field. To declare a simple property, you must specify the simple_mod parameter, as shown in the second syntax for PROPERTY-ENDPROPERTY.
Simple properties are not supported with unsized descriptor types.
An indexer is a special property that allows data in a class to be accessed using array syntax. You can declare one or more indexer properties for a class by declaring a property with the name “indexer” followed by one or more array index arguments. (Note that you cannot specify arguments for nonindexer properties.) For example,
class myclass private record myarray, i4 ; private field endrecord public property indexer, i4 index1, i4 method get proc mreturn myarray[index1] endmethod method set proc myarray[index1] = value mreturn endmethod endproperty endclass
The get accessor for an indexer has access to all the arguments of the indexer. The set accessor for an indexer has access to all those same arguments plus the implicit value argument.
See Properties and indexers for more information.
The example below declares a get accessor method for myproperty that returns the value of the property.
private record myfield, i4 ;A private field endrecord public property myproperty, i4 method get proc mreturn myfield endmethod endproperty
The following example declares a set accessor method that sets the value of myproperty.
private record myfield, i4 ;A private field endrecord public property myproperty, i4 method set proc myfield = value mreturn endmethod endproperty
The example below declares a simple property named tprop90 that generates public get and set accessors and has an initial value of “goodbye”:
readwrite property tprop90, string, "goodbye"