Top
NetCOBOL V11.0 Getting Started with COM Components
FUJITSU Software

1.3 Inheritance

By examining the FILEIO4 class source code, you’ll first notice that instead of a PROGRAM-ID statement, we have a CLASS-ID statement as follows:

 Class-ID. FILEIO4 Inherits FJBASE.

The Inherits statement is another object-oriented term. In this case, it means that the class named FILEIO4 inherits all of the methods and properties from the FJBASE class. Inheritance is a very powerful feature of object-oriented programming. It means that a class can be created on top of another class, adding all of the inherited class’ functionality (properties and methods) into it automatically.

All Fujitsu OO COBOL classes typically inherit from the FJBASE base class, which is the Base class for Fujitsu OO COBOL. This saves a lot of time and trouble in developing applications.

For example, the program shown in Figure 1.1 is calling a method in the FILEIO4 class named “NEW” to create a new instance of it at runtime. If you examine the actual source code for the FILEIO4 class, however, you will note that there is no method definition named “NEW” in this class. The “NEW” method is actually contained in the FJBASE class and because the FILEIO4 class inherits from the FJBASE class, the “NEW” method is available for the FILEIO4 class.