1. Introduction

To someone coming from the Java world to the world of Kotlin, the concepts of Covariance and Contravariance can be somewhat overwhelming to grab at first. But they don’t have to be once you start understanding the basic cadence of it. This article is going to be a step by step depiction of how I have come to understand these two topics.

2. Let’s create some classes!

First let’s create a small class hierarchy that we can use to understand these concepts. Paper is the parent class of the Regular paper and the Premium paper.