Define a variable or property of a class type

To access the PUBLIC data members and methods of a class instance, you must first define a variable or property that will hold the reference to the instance. The type you specify is a user-defined type, which is the name of the class. When you define this data member, you specify its access mode just as you do for other data members. If you want other parts of the application to access this data member, you define it as PUBLIC. Otherwise, you define it as according to your access mode best practices.

Here is the simplified syntax for creating a variable or property that holds the reference to a class instance:

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

Syntax Element

Description

access mode

Specifies whether the variable or property will be available to other parts of the application. See Access modes.

name

The name of the variable or property that you will use to reference the class instance

class-name

The name of the class previously specified in a using statement

parameter

The name for the parameter

Here is the definition of the DeptRef variable in the Company class. It will hold a reference to an instance of a Dept class.

define private variable DeptRef as Dept no-undo.
See also: