Search Results

Search found 1 results on 1 pages for 'alexmac'.

Page 1/1 | 1 

  • Covariance vs. contravariance

    - by alexmac
    What are the concepts of covariance and contravariance? Given 2 classes, Animal and Elephant (which inherits from Animal), my understanding is that you get runtime errors in .NET if you try and put an Elephant into an array of Animal, which happens because Elephant is "bigger" (more specific) than Animal. But could you assign Animal to an array of Elephants as Elephant is guaranteed to contain the Animal properties?

    Read the article

1