Next: The need to change
 Up: Typing in object-oriented languages: 
 Previous: Differences between subtypes and
 
Languages like Object Pascal, Modula-3, and C++ arose as 
object-oriented extensions of imperative programming languages.
The static type systems of these languages have relatively simple 
and straightforward type systems whose features are similar to those 
of the procedural languages from which they were derived.  In these simple 
type systems, the programmer has little flexibility in redefining methods 
in subclasses, as they require that a redefined method have exactly the
same type as the original method in the superclass.
  
However, when a method
is inherited or redefined in the subclass, one is often able to deduce more 
refined types for methods than the language allows to be written.  We present
examples illustrating this below.
First a note on the terminology used in our examples.  We use the convention in
this paper of writing 
 for the type of objects generated by 
class 
.  Thus in Figure 7, 
 is
the type of objects generated by class 
.  
As mentioned in the previous subsection, we will find it helpful to 
keep the notions of class and type separate.  The type represents 
only the public interface of the object (in our case the types of all of 
the methods, but none of the instance variables), while the class includes
initial values for instance variables and code for methods.
 
 
 
 
  
 Next: The need to change
 Up: Typing in object-oriented languages: 
 Previous: Differences between subtypes and
Kim Bruce
10/28/1998