Scala : Understanding Variance

Variance in Scala is an aspect related to parameterized types. The use of variance in the type system allows us to make intuitive connections between complex types, whereas the lack of variance can restrict the reuse of a class abstraction. We start with an example to understand the theory. Lets define a bag that can be full or empty