Skip to main content

Checkpoint: Polymorphism

intermediate35 min readLesson 86 of 204

An interface, two implementations, dispatch through a container of base pointers — the OOP module's core in one design.

Design and implement a small polymorphic system end to end:

  • the interface (Notifier) owns no state — only the contract
  • each implementation carries its own identity (channel()) and behavior (send())
  • the caller never mentions a concrete type after construction
  • the base enforces the virtual-destructor rule so container cleanup is safe

If your solution needs a dynamic_cast or an if on type, re-read the lesson on dispatch — polymorphism means the object itself answers.