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.
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
All developers know that in SOLID principles, L stands for Liskov’s substitution principle. It simply means that a subtype…