Try OpenEdge Now
skip to main content
Object-oriented Programming
Designing Objects: Inheritance, Polymorphism, and Delegation : Class hierarchies and inheritance : Classes and strong typing
 

Classes and strong typing

Classes in ABL are strongly-typed. Strong typing means that the class definition and any references to the class are checked for validity at both compile time and run time. As described in Object-oriented Programming and ABL, compile-time validation is one of the key advantages of programming with classes. Note also, that the data type of an object can be represented as any class type (abstract or non-abstract) in its class hierarchy, and as any interface type that classes in the hierarchy implement. This type representation determines how the object can be used.
In order to support strong typing, either the source files or r-code for all classes in an application must be appropriately available at compile time. Thus, when you are compiling a class that extends a class hierarchy, all the classes and interfaces for the hierarchy must be available either as source files or as r-code files.
In addition, the compilation of a subclass forces the recompilation of any class or interface in its class hierarchy. Since a class is built from all of the classes and interfaces in its hierarchy it is important to make sure that the entire hierarchy is up to date. If any class or interface in the hierarchy cannot be compiled, the compilation of the subclass fails.
Caution: When you compile a class, although ABL automatically compiles all super classes in its class hierarchy, it does not know about and cannot automatically compile any of the subclasses of the class you are compiling. Thus, when you change a super class, you must compile the class and all subclasses of the class to ensure that all objects with this class in their hierarchy inherit the updated class members. ABL, by itself, has no knowledge of these subclasses, so you must keep track of them manually or by using configuration management tools.
The compiler can handle compilation of a set of classes in any order as long as either the source or r-code can be found for all referenced classes. The compilation of a class can cause many other class files to be examined, and the compilation of a procedure that uses classes can cause those class files to be examined as well.
For more information on class compilation, see Compiling class definition files.