Introduction to OOP: Chapter 10: Subclasses and Subtypes [next] [previous] [audio] [real] [text]

Subclasses and Subtypes

A subclass is simply a class formed using inheritance.

A subtype is is class that can be substituted (using polymorphism) with no observable effect.

Not all subclasses are subtypes.

In some languages (C++) subtypes can ONLY be formed using subclasses. In other languages (Smalltalk, Objective-C) they are totally independent.

Java is in between - subtypes can be formed out of subclasses, or using interfaces.

Intro OOP, Chapter 10, Slide 7