Class variables
- Last Updated: January 29, 2026
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
You define a variable for a class is similar to how you define a variable for a procedure. The main difference is in the access mode you specify for the variable.
Here is the simplified ABL syntax to define a variable data member:
VAR access-mode type-name variable-name.
| 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 as |
|
type-name |
Can be one of the ABL data types such as integer or character or it can be a user-defined type. |
|
variable-name |
Must begin with a letter and it can contain letters, numbers, underscores, or hyphens. It must not contain periods or spaces. |
Here is a variable data member defined for the Dept class. Every instance
of a Dept class will hold its own values for this data member. Since this data member is
PRIVATE, it will be accessible only by the methods
of this class.
class Enterprise.HR.Dept:
//used for keeping track of how many employees
//are in the set of employees for the department
//used internally within the class.
var private integer NumEmployee.
// rest of class definition
end class.
- VAR statement
- DEFINE VARIABLE statement in ABL Reference
- Local variables and other data elements of methods in Develop Object-oriented ABL Applications