Inheritance-Based Subtyping

25 August 2002

New Image

There is a great divide between the study of the foundations off object-oriented languages and the practice of mainstream object-oriented languages like JAVA[AG98] and C++[Str97]. One of the most striking examples of this divide is the role that class inheritance plays in defining subtyping relations. In most foundational descriptions of OO languages, and in the language designs that these studies have informed, inheritance does not define any subtyping relation, whereas in languages like JAVA and C++, inheritance defines a subtyping hierarchy. What is interesting about this distinction is that there are certain idioms, such as friend functions and binary methods, that are natural to express in an inheritance-based subtying framework, but which require substantial complication to handle in a structural subtyping framework. In this paper, we explore why inheritance-based subtyping relations are useful and present a formal accounting of a small language that supports such subtyping relations.