Skip to main content

2 docs tagged with "liskov-substitution"

View all tags

Chapter 9: LSP — The Liskov Substitution Principle

If S is a subtype of T, objects of type S must be substitutable for objects of type T without altering the correctness of the program. LSP governs not just inheritance but any interface contract — and its violation breaks architectural boundaries.

Liskov Substitution Principle

If class `B` extends class `A`, then anywhere you use `A`, you should be able to swap in `B` without anything breaking.