Card 08/ 08

RecapDifficulty: Advanced1 min

Recap: Interfaces and Abstract Classes

Capabilities, shared state, the deciding question, default methods and single inheritance, with where each was.

Interfaces and abstract classes come down to the five ideas below, each listed with the card that covers it.

What the topic established, and which card it was on
The ideaWhere
An interface names a capability and holds no per-object stateJava Interfaces: Naming a Capability Without an Implementation
An abstract class is a partly built class, with fields and a constructorAbstract Classes: Shared State and a Fixed Sequence
The deciding question is whether there is shared stateInterface vs Abstract Class
A default method lets an interface grow without breaking implementationsDefault Methods in Java Interfaces
One extends, any number of implements, because interfaces add no fieldsSingle Inheritance: One extends, Many implements

State is the whole distinction. How many you may have, what a default method may touch, and why constants in an interface are shared all follow from an interface having none.