Contravariance
Definition, Meaning & Examples
Part of speech noun
Quick meaning: Contravariance is a noun meaning (object-oriented programming) The reversal of the order of data types acted upon by an operator.
Meaning
(object-oriented programming) The reversal of the order of data types acted upon by an operator.
More Meanings
- (category theory) A functor which reverses composition.
- (linear algebra) Of vectors, the property of scaling inversely with a change of basis, as opposed to covariance.
Example Sentences
I get why with covariance I can return a Dog (a Dog is a Mammal), but why does contravariance work the other way? Shouldn't it accept a derived type when it expects a base type? Contravariance is consistent with Postel's Law: […]
Word Forms
- contravariances
Related Words
Related dictionary entries include mapping, overloading, unboxing, coercion, polymorphism, homoiconicity.
Related Dictionary Tools
Sources & Attribution
FreeDictionaryAPI.com / Wiktionary · Original source · CC BY-SA 4.0
Dictionary data is provided by FreeDictionaryAPI.com and sourced from Wiktionary under its stated license.