We often hear that concept of Variance is hard to understand. Even most of the books and tutorials don’t put much emphasis on the topic.
But we are unknowingly using power of variance in very basic use of language features, daily. Also once you get the idea, it is very simple.

Complex data types, whats inside the types and how it is related
Complex data types, whats inside the types and how it is related

Be contravariant in the input type and covariant in the output type
- Robustness Principle

Lets start from the basics, Polymorphism

Polymorphism has below two forms
1. Subtyping
2. Generics

All developers know that in SOLID principles, L stands for Liskov’s substitution principle. It simply means that a subtype…

arshad ali sayed

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store