2 ms·
> Inheritance is a result of several insights: > 1. It's convenient to be able to sketch out a protocol which a set of objects will follow - without having to
by chacham15 7y ago
> Inheritance is a result of several insights:
> 1. It's convenient to be able to sketch out a protocol which a set of objects will follow - without having to work out every damn detail about its implementation.
> 2. Most of the protocol can be implemented once and then reused.
> 3. Often you want to use the default protocol implementation with some changes. Instead of re-implementing the rest of the protocol, it's highly convenient to be able to specify only the differences.
> #3 is the core reason why inheritance was developed.
Those insights lead to what was taught in my intro to cs class: abstraction. Inheritance can be used to implement abstraction, but so can many other concepts such as duck typing or aspect oriented programming.