Contents | Prev | Next | Index


Inheritance

A class type can inherit members from another class type. If T2 inherits from T1, then T2 is a descendant of T1, and T1 is an ancestor of T2. Inheritance is transitive meaning that if T3 inherits from T2, and T2 inherits from T1, then T3 also inherits from T1. The domain of a class type consists of itself and all of its descendants. An ancestor is also called as superclass, and a descendant is also called a subclass. A subclass extends a superclass.

A descendant can define additional components to those it inherits. It cannot, however, remove the definition of components inherited from ancestors.

The ultimate ancestor of all class types is the Java class java.lang.Object. If the declaration of a class type does not explicitly specify the name of its ancestor, the class type will be derived from that Java class java.lang.Object.

Notice that, unlike other Pascal compilers such as Borland Object Pascal, Canterbury Pascal does not have in its present version a predefined class named SYSTEM.TObject nor any of its descendants. The whole class hierarchy of Canterbury Pascal is ultimately derived from Java classes. Any existing foreign Java class created outside Canterbury Pascal can be used via a direct import mechanism, without the need for writing foreign interface units. This way Canterbury Pascal can make use of any Java feature available, such as graphics, windowing, event handlers, databases and much more. It is beyond the scope of this documentation to describe every Java class. For more information on Java class library reference books see the Web page at http://www.webcom.com/mhc/javabooks.html.


Contents | Prev | Next | Index

Canterbury Pascal for JVM  (Last documentation update Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com  . All rights reserved.
Please send any comments or corrections to neuhoff@mhccorp.com