Covariance and Contravariance in Scala
Reading Time: 3 minutes Variance is the quality of being different. It is the correlation of subtyping relationships of complex types and subtyping relationships of their component types.Covariance allows assigning an instance to a variable whose type is one of the instance’s generic type; i.e. supertype.Contravariance allows assigning an instance to a variable whose type is one of the instance’s derived type; i.e. subtype. Before learning about variances, prerequisite Continue Reading