From COBOL to OOP

Chapter 5: True Object-Oriented Programming

Overview

We have learned important basics and fundamental differences between object-oriented programming languages and COBOL in the previous chapters. This chapter discusses the nuts and bolts of object-oriented programming.

The first sections explain important terms, including classes and inheritance, then discuss possible applications of object-oriented programming in detail. Class libraries, basic to object-oriented programming, are also described.

Although the examples are shown in Java and Delphi, it would also be possible to implement them in OO-COBOL. However, OO-COBOL was explained in Section 1.5; therefore, this chapter includes only the short Section 5.2.4, which covers the new COBOL variant.

5.1 Classes

Classes: the fundamental concept of OOP

This first tutorial section presents the fundamental concept of object-oriented programming: the class, with its attributes and methods. It also discusses the main ideas and characteristics behind object-oriented programming.

5.1.1 Class Definition

Classes are similar to records

A class is similar to the record we know from a previous chapter. For example, in connection with the Java definition, we said Java has no real records, but instead classes. A better comparison is to compare a class with an abstract data type (see Section 4.1). Like an abstract data type, a class offers attributes and operations (procedures). In object-oriented programming, these operations are also called methods. The short source code fragments we use in this chapter show how the abstract data type previously discussed can be represented as a class.

Delphi

In contrast to a record, a class definition...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Programming Languages
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.