Published in
Mar 3, 2022
Liskovs substitution principle (LSP)
LSP is an extension of Open Closed principle.
It states that objects of derived class must be completely substitutable for the objects of base class.
If you have a function that takes a base class as argument than it should take the derived class also as argument without breaking the functionality.
Implementation:
No new exceptions can be thrown by the derived class.
New derived classes should just extend without replacing the functionalities of the base class.
Thanks for reading through the article. Follow for more.