DEV Community


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

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.

huzaifa99 profile image
Huzaifa Rasheed Author


Forem Open with the Forem app