4 ms·
T is covariant (positive) if A ≤: B ⇒ T<A> ≤: T<B>. T is contravariant (negative) if A ≤: B ⇒ T<B> ≤: T<A> (i.e., the other way around). Pretty simple stuff.
by evincarofautumn 13y ago
T is covariant (positive) if A ≤: B ⇒ T<A> ≤: T<B>. T is contravariant (negative) if A ≤: B ⇒ T<B> ≤: T<A> (i.e., the other way around). Pretty simple stuff.
- pkolaczk 13y agoIt is easy to remember if you think of it: + (covariant): the type can be cast to some broader (more general) type - (contravariant): the type can be cast to some narrower (more concrete) type