Definition
Subtype Relation
The subtype relation is a partial order, often denoted as or , meaning type is a subtype of type , where is called supertype of . It signifies that any term or value of type can be safely used in any context where a term or value of type is expected. This is known as the principle of substitutability.
Language-Specific
Java
Let be reference types.
- (reflexive)
- (transitive)
- (antisymmetric)
Thus, the subtype relation is a partial order.
- Every dynamic type is a Java class
- is not an object of , whereby the compiler accepts it
Assumption: Method comments in and are compatible, with :
- Comment in explains the same method as comment in
- Comment in can be more concrete
- Comment in can be more abstract