Natural for Mainframes Version 8.2.6 for Mainframes
 —  Statements  —

DEFINE CLASS

DEFINE CLASS class-name

OBJECT

USING

local-data-area

 
parameter-data-area
local-data-definition

LOCAL

USING

local-data-area

 
parameter-data-area
local-data-definition

INTERFACE USING copycode              
interface-statement
[property-statement]
[method-statement]
END-CLASS

This document covers the following topics:

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: CREATE OBJECT | INTERFACE | METHOD | PROPERTY | SEND METHOD

Belongs to Function Group: Component Based Programming


Function

The DEFINE CLASS statement is used to specify a class from within a Natural class module. A Natural class module consists of one DEFINE CLASS statement followed by an END statement.

Top of page

Syntax Description

Syntax Element Description
class-name
Class Name:

This is the name that is used by clients to create objects of this class. The name can be up to a maximum of 32 characters long. The name may contain periods: this can be used to construct class names such as

company-name.application-name.class-name

Each part between the periods (...) must conform to the Naming Conventions for User-Defined Variables.

If the class is planned to be used by clients written in different programming languages, the class name should be chosen in a way that it does not conflict with the naming conventions that apply in these languages.

OBJECT
OBJECT Clause:

This clause is used to define the object data. The syntax of the OBJECT clause is the same as for the LOCAL clause of the DEFINE DATA statement.

For further information, see the description of the LOCAL clause of the DEFINE DATA statement.

LOCAL
LOCAL Clause:

This clause is only used to include globally unique IDs (GUIDs) in the class definition. GUIDs need only be defined if a class is to be registered with DCOM. GUIDs are mostly defined in a local data area.

The syntax of the LOCAL clause is the same as for the LOCAL clause of the DEFINE DATA statement.

For further information, see the description of the LOCAL clause of the DEFINE DATA statement.

INTERFACE USING
INTERFACE USING Clause:

This clause is used to include copycode that contains INTERFACE statements.

copycode
Copycode:

The copycode used by the INTERFACE USING clause may contain one or more INTERFACE statements.

interface-statement
INTERFACE Statement:

The INTERFACE statement is used to define methods and properties for a class.

property-statement
PROPERTY Statement:

The PROPERTY statement is used to assign an object data variable operand as the implementation to a property, outside an interface definition.

method-statement
METHOD Statement:

The METHOD statement is used to assign a subprogram as the implementation to a method, outside an interface definition.

END-CLASS
End of DEFINE CLASS Statement:

The Natural reserved word END-CLASS must be used to end the DEFINE CLASS statement.

Top of page