Define a static data member
- Last Updated: August 17, 2021
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
In your class, you define a PUBLIC
static data member to represent a single instance of the class that runs in the AVM.
Here is the syntax for defining a static property as a data member:
define public static property <property-name> as {<type-name>} [no-undo]
public get [():
<body of get that returns property>
end get].
[<access-mode>] set[(<param>):
<body of set that sets property>
end set].
|
Syntax Element |
Description |
|
access-mode |
Specifies whether the data member will be available
to other parts of an application. As a best practice, you should
define a set to be |
|
property-name |
The name of the data member. |
|
type-name |
A built-in ABL type or a user-defined type. |
|
param |
The value that is used to set the property. It must match the type of the property. |
Here is the definition of the public static data member, Instance, for
the Corporation class. This data member will be used to
hold the single and only instance of the Corporation
class in the AVM. Notice that you must include the full name of the class for the type
that includes the package, Enterprise.Corporation.
define public static property Instance as Enterprise.Corporation no-undo
get.
private set.