3 ms·
The problem is “A extends B”. You want to teach “A implements B” first. The important idea is that there’s a protocol/interface for which there can be different
by layer8 4y ago
The problem is “A extends B”. You want to teach “A implements B” first. The important idea is that there’s a protocol/interface for which there can be different implementations used in parallel at runtime, and the interface type allows the client code to abstract from the different implementations. The next step is that an implementation may implement multiple interfaces at once, which also may be subinterfaces of one another. Only as a last step you can introduce implementation inheritance, which is just an optimization (both in runtime mechanism and code verbosity) when reusing code, an optimization which comes at a cost regarding maintenance and implementation dependencies.