From a theoretical perspective object orientation
may be characterized as combining abstract data types
and polymorphism.
Polymorphism
9
- abstract inheritance
- subtypes
- type abstraction
- self-reference
Additional keywords and phrases:
exceptions, type calculi,
parametric types, coercion, ad hoc polymorphism,
universal types, existential types,
unfolding, intersection types
slide: Polymorphism
In this chapter we will study the notion of polymorphism.
We start our exploration by \nop{briefly} looking at the
role of \nop{abstract} inheritance in knowledge representation.
Then we will formally characterize the (signature)
subtype relation and explain the contravariance rule
for function subtypes.
To better understand polymorphism and its relation to
inheritance, we will
develop a type calculus,
allowing us to define abstract types using
universally and existentially quantified type
expressions.
In a similar way, we will look at polymorphism due
to overloading and generic type definitions.
Finally, we will look at the role of
self-reference in typing object descriptions derived by inheritance.
Together with developing the calculi,
examples will be given that illustrate
the properties of the C++ and Eiffel
type systems.