DEV Community

loading...

Discussion on: Solid. Is It Still Useful In 2021?

Collapse
andreidascalu profile image
Andrei Dascalu

"we should be able to use a child and a parent class interchangeably" - no, not interchangeably. Liskov only states that a subclass should be usableable instead of the parent. Not necessarily the other way around. It's perfectly acceptable to add a method in a subclass.
In fact it's right there in the article you linked.

Collapse
huzaifa99 profile image
Huzaifa Rasheed Author

Updated.

Forem Open with the Forem app