Covariance and contravariance (computer science): Difference between revisions

Content deleted Content added
Giving an example of a language that supports contravariance in parameter types
Line 168:
</syntaxhighlight>
 
NotOnly manya few object-oriented languages actually allow this (for example, Python when typechecked with mypy). C++, Java and most other languages that support [[Function overloading|overloading]] and/or [[Variable shadowing|shadowing]] would interpret this as a method with an overloaded or shadowed name.
 
However, [[Sather]] supported both covariance and contravariance. Calling convention for overridden methods are covariant with ''out'' parameters and return values, and contravariant with normal parameters (with the mode ''in'').