+ 3

C++ Solid principles

Can anyone help me understand solid principles c++? Has anyone got any code examples?

16th Feb 2025, 10:56 PM
oliver morten
oliver morten - avatar
2 ответов
+ 2
The term solid have 5different principle: S-Single Responsibility Principle (SRP) *This means a class should have only one task to do and not responsible for multi- tasks. O-Open/Closed Principle *This means we can add a new functionality for a class without modifying the existing code. L-Liskov’s Substitution Principle (LSP) * This means that a derived class should be able to be used in place of its base class without any error. I-Interface Segregation Principle (ISP) *This means creating an Interfaces which should be designed for a specific need. D-Dependency Inversion Principle (DIP) * High level module should depend on abstractions rather than low level module.
17th Feb 2025, 2:31 PM
Lekhya
Lekhya - avatar
+ 2
Check this code, I've explained SOLID Principles with examples: https://sololearn.com/compiler-playground/c7tbZp4psrsu/?ref=app
18th Feb 2025, 12:27 PM
Afnan Irtesum Chowdhury
Afnan Irtesum Chowdhury - avatar