Software Engineering KB

Home

❯

02 Programming Languages and Paradigms

❯

01 Type Systems

❯

02 Sub Concept

❯

Variance

Variance

Feb 10, 20261 min read

  • type-systems
  • generics
  • variance
  • covariance
  • contravariance

Variance

← Back to Generics - Parametric Polymorphism

Rules governing subtyping relationships between parameterized types. Covariance (List<Dog> is a subtype of List<Animal>) preserves the subtype relationship, contravariance reverses it, and invariance allows neither. Variance annotations ensure type safety when using generics with inheritance.

type-systems generics variance covariance contravariance


Graph View

Backlinks

  • Generics - Parametric Polymorphism

Created with Quartz v4.5.2 © 2026

  • GitHub