Appearance
Lesson 8 Companion — Interfaces & Contract-Based Design
1. Interface methods
Classes that implement an interface must provide the required implementations unless abstract-class rules apply.
2. Interface reference
The static type exposes only the interface contract. Concrete-class-specific methods are not directly available through the interface reference.
3. Interface segregation idea
Small focused interfaces are easier to implement and reuse than a large interface containing unrelated responsibilities.
4. Interfaces vs deep inheritance
If classes only need to share a capability, an interface often expresses the relationship better than forcing them into an artificial inheritance hierarchy.