Introduction to OOP
Chapter 8: Inheritance and Substitution:
Subclass vs Subtype
Of course, the problem with this argument is that a child class can override a method and make arbitrary changes. It is therefore useful to define two separate concepts:
To say that A is a
of B merely asserts that A is formed using inheritance.
To say that a is a
of B asserts that A preserves the meaning of all the operations in B.
It is possible to form subclasses that are not subtypes; and (in some languages at least) form subtypes that are not subclasses.
, Slide 12
(We will have much more to say on this topic in a later chapter).