Understanding and Implementing the Liskov Substitution Principle in Object-Oriented Programming

solid principle

The Liskov Substitution Principle (LSP) is a principle in object-oriented programming that states that objects of a superclass should be able to be replaced with objects of a subclass without affecting the correctness of the program. This principle is a part of the SOLID principles of object-oriented design. Here are three examples of LSP in … Read more

Do you REALLY know what SOLID principles means? Think again! (#3: Liskov Substitution Principle)

Liskov Substitution Principle

Liskov Substitution Formal definition of Liskov substitution principle is –Let φ(x) be a property provable about objects x of type T. Then φ(y) should also be true for objects y of type S where S is a sub-type of T. Or we can say – If class A is a sub-type of class B, then … Read more