SOLID Principles explained using CPP language
Five Principles are:
- Single Responsibility Principle: Every Software Component should have one and only one reason to change. Aim for high cohesion and loose coupling.
- Open Closed Principle: Software components should be closed for modification, but open for extension.
- Liskov Substitution Principle: Objects should be replacable with their sub types without affecting the correctness of the program.
- Interface Segregation Principle: No client should be forced to depend on methods it does not use.
- Dependency Inversion Principle: High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstraction.
There are 5 header files each explaining one of the five SOLID Principles with the help of examples and comments. There is first bad implementation example given and then with the help of comments it is explained how it can be improved according to SOLID Principles.