3 ms·
When done well inheritance allows you to denote which parts of your class could be overridden. I don't think it's wrong to think of inheritance as an implicit i
by contravariant 6y ago
When done well inheritance allows you to denote which parts of your class could be overridden. I don't think it's wrong to think of inheritance as an implicit interface, but I'm not 100% sure if all languages have interfaces powerful enough to replace inheritance. If you're careful with what parts you allow subclasses to access and override then it's not too different from using interfaces, and not too hard to refactor when you want to split it out into interfaces.
I also think class hierarchies are simply the natural way humans think of concepts, and inheritance seems to work well if you're inheriting from more abstract classes to more concrete implementations.