OBJECT()

Top  Previous  Next

 

The OBJECT() function instantiates an object for object oriented programming.

 

 

Format

 

OBJECT(cat.name, {args...})

 

where

 

cat.nameis the name of the catalogued CLASS module defining the object.

 

argsare optional arguments that will be passed into the CREATE.OBJECT subroutine.

 

 

The OBJECT() function loads the catalogued class module defined by cat.name and creates an object that references it. The function returns and object reference that should be stored in a program variable.

 

OBJ = OBJECT("MYOBJECT")

 

If the class module includes a public subroutine named CREATE.OBJECT this is executed as part of object instantiation.

 

Copying an object reference variable creates a second reference to the same object, not a new instantiation of the same object.

 

The object remains in existence until the last variable referencing it is overwritten or discarded. At this point, if the class module includes a public subroutine named DESTROY.OBJECT, it will be executed.

 

 

See also:

Object oriented programming, CLASS, DISINHERIT, INHERIT, PRIVATE, PUBLIC.