The object oriented design principles are used to achieve highly cohesive and loosely couple solution. Design principles provides us a way to create the clean and modular design.
The SOLID principles of Object Oriented Design include following five principles:
- Single Responsibility Principle (SRP)
- Open Closed Design Principle (OCP)
- Liskov Substitution Principle (LSP)
- Interface Segregation Principle (ISP)
- Dependency Injection or Inversion principle (DIP)
Liskov Substitution Principle (LSP)
It is a SOLID design principle and represent “L” on the SOLID acronym. According to LSP subtypes must be substitutable for supertype. The main concept behind LSP SOLID design principle is that derived class or subclass must enhance functionality not reduce.
For example we have Animal class with a MakeNoise() method then any subclass of Animal should implement makeNoise().