skip to main content

Object-oriented Programming : Objects : Object instantiations

Object instantiations
The individual members of a class are called instance objects, or simply instances. For example, an individual checking account object can be called a checking account object instance, or a checking account instance. We will use the term instance to refer to an individual member of a class.
All instances of a class share the same data definition, but each instance has its own unique values.
The instances of a class also share the same methods. A method is defined once for the class, but each instance behaves as if it is the sole owner of the methods defined for the class. The methods are shared and can be used by all instances. This facility of object oriented programming environments permits the data for each instance to be hidden (encapsulated) because it can be accessed only via the methods of the class.
The conventions used in all of the code fragments and the sample bank application are as follows:
    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).
    PROCEDURE DIVISION.
    METHOD-ID. deposit.
        method code
    END METHOD.
    METHOD-ID. withdraw.
        method code
    END METHOD.
    END OBJECT

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