Top "Covariance" questions

Covariance, contravariance and invariance describe how the existing type inheritance hierarchy changes when subjected to some transformation (such as usage within generics).

Convert List<DerivedClass> to List<BaseClass>

While we can inherit from base class/interface, why can't we declare a List<> using same class/interface? …

c# list inheritance collections covariance
Calculating Covariance with Python and Numpy

I am trying to figure out how to calculate covariance with the Python Numpy function cov. When I pass it …

python numpy covariance
numpy covariance matrix

Suppose I have two vectors of length 25, and I want to compute their covariance matrix. I try doing this with …

python numpy covariance
What is a covariant return type?

What is a covariant return type in Java? In object-oriented programming in general?

java oop covariance
Covariance and contravariance real world example

I'm having a little trouble understanding how I would use covariance and contravariance in the real world. So far, the …

c# c#-4.0 covariance
<out T> vs <T> in Generics

What is the difference between <out T> and <T>? For example: public interface IExample<out …

c# generics covariance
C#: Overriding return types

Is there way to override return types in C#? If so how, and if not why and what is a …

c# inheritance types covariance overriding
How is Generic Covariance & Contra-variance Implemented in C# 4.0?

I didn't attend PDC 2008, but I heard some news that C# 4.0 is announced to support Generic covariance and contra-variance. That …

c# c#-4.0 covariance contravariance generic-variance
Why are arrays covariant but generics are invariant?

From Effective Java by Joshua Bloch, Arrays differ from generic type in two important ways. First arrays are covariant. Generics …

java arrays generics language-design covariance