Lexicon

Replace Inheritance with Delegation

Kind: technique

Layer: Structural Core

Record: lexicon:replace-inheritance-with-delegation

Canonical: Lexicon

A technique for replacing a subclass with a class that holds the former base as a field and forwards to it.

Listed in Lexicon terms, after Split Interface and before Split Hierarchy.

Category

  • SOLID / Object-Oriented Design

Refactors

  • Composition Over Inheritance
  • Liskov Substitution Principle

Linked from

  • Core Modular Design
  • SOLID / Object-Oriented Design