DEV Community

Discussion on: The S of SOLID in my view.

Collapse
 
dscheglov profile image
Dmytro Shchehlov • Edited

@efpage you see, derived classes is not about SRP.

The inheritance is one of the ways to follow OCP (Open/Close Principle) and DIP (Dependency Inversion Principle). And more than -- it is not a best way to respect these principles.

Inheritance is a mechanism of sub-typing, limitted by LSP (Liskov Substitution Principle) that makes SRP not relevant to inheritance: Derived Class MUST DO the same stuff as a Base Class, but in differnet way, preserving safity of substitution.