CREATE OBJECT - TYPE

Syntax

CREATE OBJECT oref [area_handle]
              TYPE {class|(name)} [parameter_list].


Effect

For class you can specify any concrete class that is more specific than or identical to the static type of the object reference variable oref. oref can be a class reference variable or an interface reference variable. An instance of the specified class class is created.

As an alternative to the direct specification, you can use name to specify a character-type data object that contains the name of the class in uppercase when the statement is executed. The name of the class in name can also be an absolute type name.

Example

Generation of an instance of a class c1 through explicit reference to the class. The static type of the reference variable is the root class object and therefore more general than any other class.

CLASS c1 DEFINITION.
  ...
ENDCLASS.

...

DATA oref TYPE REF TO object.

...

CREATE OBJECT oref TYPE c1.