Slide 12
Slide 12 text
Contravariance can be very counterintuitive to
understand but essentially in common words, it means
that the combination with a certain complex type will still
result in a composed generic type in this case a
DrinksService.
The idea is that the resulting composed type will have its
own hierarchy and that can move along or against the
original hierarchy of its individual contained types. And
so Drinks service is covariant to BOX, but contravariant
to DRINK. Therefore naturally if covariant, then the type
makes only sense to use as an output and thus the
modifier out. In the same if contravariant, then it only
make sense to use that generic type as input and thus in.