- Subclasses should be substitutable for their base classes”.
- It suggests that, a component that uses a base class should continue to function properly if a class derived from the base class is passed to the component instead.
- LSP demands that any class derived from a base class must honor any implied contract between the base class and the components that use it
- In the context of this discussion, a “contract” is a precondition that must be true before the component uses a base class and a postcondition that should be true after the component uses a base class.
- When you create derived classes, be sure they conform to the pre and postconditions.
Dependency Inversion Principle (DIP)