0

About Liskov Substitution Principle

<<Derived objects should be treated as their bases without affect program correctness.>> But what're the advantages? Some key concept missing?

25th Feb 2021, 12:15 AM
Kiwwi#
Kiwwi# - avatar
1 Réponse
+ 2
Its for consistency across your program. If you modify methods in derived class that does a completely different task than its parent class, it will break the system at some point. Because someone else will try to use the derived class to do what the base class does. Since the child class should only extend the functionality of base class. Unless you are doing something special. Keep in mind the open-closed and single responsibility principle.
25th Feb 2021, 3:03 AM
Akib
Akib - avatar