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 only examples I\'ve seen have been the same old array example. object[] objectArray = new string[] { \"string 1\", \"string 2\" }; It would be nice to see an example that would allow me to use it during my development if I could see it being used elsewhere. 回答1: Let's say you have a class Person and a class that derives from it, Teacher. You have some operations that take an