Referencing an object v16
Syntax
After you create and initialize an object variable, you can reference individual attributes using dot notation of the form:
Where:
object
is the identifier assigned to the object variable.
attribute
is the identifier of an object type attribute.
If attribute
is of an object type, then the reference must take the form:
Where attribute_inner
is an identifier belonging to the object type to which attribute
references in its definition of object
.
Examples
This example displays the values assigned to the emp_obj_typ
object:
The following is the output from this anonymous block:
Methods are called in a similar manner as attributes.
Once an object variable is created and initialized, member procedures or functions are called using dot notation of the form:
Where:
object
is the identifier assigned to the object variable.
prog_name
is the identifier of the procedure or function.
Static procedures or functions aren't called using an object variable. Instead call the procedure or function using the object type name:
Where:
object_type
is the identifier assigned to the object type.
prog_name
is the identifier of the procedure or function.
You can duplicate the results of the previous anonymous block by calling the member procedure display_emp
:
The following is the output from this anonymous block:
This anonymous block creates an instance of dept_obj_typ
and calls the member procedure display_dept
:
The following is the output from this anonymous block:
You can call the static function defined in dept_obj_typ
directly by qualifying it by the object type name as follows: