Covariant
The type can vary in the direction as the subclass.
Contravariant
The reverse of covariant.
Example in Generics
Language | Covariant | Contravariant |
C# | IList<out T> | IList<in T> |
Java | List<? extends Number> | List<? super Integer> |
Extremely Serious
The type can vary in the direction as the subclass.
The reverse of covariant.
Language | Covariant | Contravariant |
C# | IList<out T> | IList<in T> |
Java | List<? extends Number> | List<? super Integer> |
© 2024 Ron and Ella Wiki Page
Theme by Anders Noren — Up ↑
Leave a Reply