How to understand the two sentences about “Covariance” and “Contravariance”?
问题 I'm reading the first section of "Scala in depth", there are two sentences in the first section about "covariance" and "contrvariance": Covariance (+T or ? extends T) is when a type can be coerced down the inheritance hierarchy. Contravariance(-T or ? super T) is when a type can be coerced up the inheritance hierarchy. I have read some documents about "Covariance" and "Contravariance", but I can't understand the word "coerced down" and "coerced up" here in this context. 回答1: [TOP / ABSTRACT]