Content deleted Content added
Reworded the second paragraph, because the first sentence's structure, built around "how … relates to …", breaks its definition into separated halves, and readers must infer (due to the vagueness of "how") what type of thing "variance" might be. The next two sentences, both rhetorical questions, are converted to a single sentence of statements. NOTE: This edit would be significantly improved by enumerating variance types in sentence 1, and stating their effects on the examples in sentence 2. |
Bivariance means equality of types. Tags: Reverted Visual edit Mobile edit Mobile web edit |
||
Line 109:
== Inheritance in object-oriented languages ==
When a subclass [[Method overriding|overrides]] a method in a superclass, the compiler must check that the overriding method has the right type. While some languages require that the type exactly matches the type in the superclass (
<gallery perrow="5" heights="190" caption="Variance and method overriding: overview">
|