9.5 Implementation vs. Interface Inheritance

Interface Inheritance vs Implementation Inheritance

How do we differentiate between "interface inheritance" and "implementation inheritance"? Well, you can use this simple distinction:

  • Interface inheritance (what): Simply tells what the subclasses are able to do.

    • EX) all lists should be able to print themselves, how they do it is up to them.

  • Implementation inheritance (how): Tells the subclasses how to implement their behavior.

    • EX) Lists should (by default) print themselves exactly this way: by getting each element in order and then printing them.

Last updated