skip to main content

Object-oriented Programming : Objects : Object data definitions

Object data definitions
Since each instance object is unique, it has a unique reference value that is generated by the runtime system when the instance is created. An object's reference value serves as a pointer to that specific instance. An object reference value can be thought of as a key that identifies a specific instance. The usage clause provides a means to define a data item, called an object reference, to hold an object's reference value. In the following example, data items a-checking-account and an-account are object references:
    OBJECT.
    DATA DIVISION.
    WORKING-STORAGE SECTION.
    01  checking-account.
        03 customer-name    PIC X(35).
        03 current-balance  PIC S9(9)V99.
        03 date-opened      PIC 9(8).
    01  a-checking-account  USAGE IS OBJECT REFERENCE.
    01  an-account          USAGE IS OBJECT REFERENCE.
    PROCEDURE DIVISION.
    SET an-account TO a-checking-account.

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left