DEV Community

Discussion on: SOLID: Liskov Substitution Principle

Collapse
 
gorynych profile image
Info Comment hidden by post author - thread only visible in this permalink
Stepan Mozyra

Yes, Mihail, this is because of not really good example. Abstract class in this article not an abstract class at all, but an interface.

Real problem occurs when you have some implementation in your base class, but then overrides it in ancestor. This what LSP is actually about. (And there's just a simple rule to prevent such a violation)

Collapse
 
qm3ster profile image
Mihail Malo

Bruuuh inheritance is scary lmao

Some comments have been hidden by the post's author - find out more