Liskov Substitution Principle
The Liskov Substitution Principle (LSP) is a fundamental concept in object-oriented programming that states that objects of a superclass should be replaceable with objects of a subclass without affecting the correctness of the program. This means that if a class A is a subclass of class B, then an instance of A should be able to stand in for an instance of B without causing errors or unexpected behavior.
To adhere to LSP, subclasses must implement the same behavior as their parent class and not violate any assumptions made by the parent class. This ensures that the program remains predictable and maintainable, allowing developers to extend functionality through inheritance while preserving the integrity of the original code.