Creating Objects

To create an object from the IDL object class library, use the OBJ_NEW function. See "OBJ_NEW" (IDL Reference Guide). The Init method for each class describes the arguments and keywords available when you are creating a new object.

For example, to create a new object from the IDLgrAxis class, use the following call to OBJ_NEW along with the arguments and keywords accepted by the IDLgrAxis::Init method:

myAxis = OBJ_NEW('IDLgrAxis', DIRECTION = 1, RANGE = [0.0, 40.0]) 

When you create an object, it is persistent, meaning it exists in memory until you destroy it. You use an object reference (myAxis) to access the data associated with the object. This object reference actually accesses an object heap variable. (See Object Heap Variables for details.)

Once an object has been created, you can access and modify it as needed. (See The Object Lifecycle for additional information.) However, you should always explicitly clean up object references before ending a program. See Destroying Objects for more information.