supertypesubtype
Supertypesubtype is a term describing the core relationship in type systems between a type that is more general (the supertype) and a type that is more specific (the subtype). The subtyping relation is typically reflexive and transitive: every type is a subtype of itself, and if B is a subtype of A and C is a subtype of B, then C is a subtype of A. In practice, values of a subtype can be used wherever a value of the supertype is expected, a principle known as substitutability.
In common programming languages, subtyping underpins polymorphism. For example, in Java or C#, Integer is a subtype
Subtyping interacts with variance, especially in function types and generics. For function values, parameter types are
Practical implications include code reuse, API design, and safety guarantees. Subtyping enables abstraction and polymorphic behavior,