Java Reference
In-Depth Information
or
If you understand these terms and followed the descriptions of these concepts,
you understand the most important OO concepts (classes, objects, and members).
These concepts are the core principles (or building blocks) of any OO language, in-
cluding Java.
O BJECTS AND COBOL
In the COBOL examples, you simulated the concept of object instance variables by
creating unique instances of MYSUB-CONTROL:
01 MYSUB1-CONTROL.
03 MYSUB1-ACTION-SWITCH PIC X.
03 MSG-SIZE PIC 9(8).
...
01 MYSUB2-CONTROL.
03 MYSUB2-ACTION-SWITCH PIC X.
03 MSG-SIZE PIC 9(8).
...
The program that contained both of these definitions and also called MYSUB
with each one would now have two unique instances of the variables in MYSUBx-
CONTROL, reflecting the result of MYSUB's logic:
IF MSG-SIZE OF MYSUB1-CONTROL = 0
...
ELSE IF MSG-SIZE OF MYSUB2-CONTROL = 0
...
END-IF
Of course, any other calling program could use the name MYSUB-CONTROL or
MYSUB1-CONTROL. These would refer to a different instance of this CONTROL.
 
Search WWH ::




Custom Search