A value of a subtype can be substituted for a value of a supertype.

Related concepts:  TypePolymorphismInheritance

Closest Wikipedia entry:  Subtyping — In programming language theory, subtyping (also subtype polymorphism or inclusion polymorphism) is a form of type polymorphism in which a subtype is a datatype that is related to another datatype (the supertype) by some notion of substitutability, meaning that program elements, typically subroutines or functions, written to operate on elements of the supertype can also operate on elements of the subtype. If S is a subtype of T, the subtyping relation (written as S <: T, S ⊑ T, or S ≤: T ) means that any term of type S can safely be used in any context where a term of type T is expected. The precise semantics of subtyping here crucially depends on the particulars of how "safely be used" and "any context" are defined by a given type formalism or programming language.

Misconceptions about Subtyping
11 documented Misconceptions

Check Yourself

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.