How can violating LSP cause issues in software design?
Violating LSP can lead to:
- Unexpected behavior when a subclass does not honor the contract of the base
class.
- Code that breaks at runtime when substituting a derived class.
- Tightly coupled code that depends on specific implementations rather than
abstractions.
- Unit tests failing when testing subclasses in place of base classes.
Essentially, it defeats the purpose of polymorphism.