Generics invariant covariant contravariant in scala
问题 This could be a very silly question, but I am not able to understand the difference even after scratching my head for a long time. I am going through the page of scala generics: https://docs.scala-lang.org/tour/generic-classes.html Here, it is said that Note: subtyping of generic types is invariant . This means that if we have a stack of characters of type Stack[Char] then it cannot be used as an integer stack of type Stack[Int]. This would be unsound because it would enable us to enter true