Object Classes

Dynamic typing subsumes sub typing and provide for the integration of object-oriented concepts and Algol-style languages in a natural way. For example

Suppliers : set of U
can be seen as the declaration of an object class and
Parts-supplied : Suppliers set of Parts
can be seen as the declaration of a member variable for class Suppliers. Dynamically creating new abstract values and including them in set Suppliers amounts to dynamically creating objects of class Suppliers.

Derived classes correspond to subtypes, and inheritance follows naturally. For example, given type (class) A, an operator (method) f : A A →A, and a subtype (derived class) B ⊂A, then f may obviously be applied to arguments of type B. Moreover, the value resulting from the application of f to arguments of type B may well be a member of B and thus may be assigned to a variable of type B, subject to a ``run-time'' type check. In other words, subtype (derived class) B effectively inherits operator (method) f from supertype (super class) A.

Inherited methods can be overridden by allowing operators (methods) to be overloaded. However, operator/function names cannot be as freely overloaded as in a language like Ada. For example, if

f : A →C, f : B →C, and A B = {ab}
then it is impossible to determine which f must be used when one encounters f(ab).

Similar difficulties arise in object-oriented languages that allow multiple inheritance and similar solutions can be adopted.


next up previous

Prof Herman Venter
Thu May 2 09:26:52 GMT 1996