Static Versus Dynamic Polymorphism

Let's dive deep into polymorphism in this lesson.

We'll cover the following

Polymorphism

Polymorphism means that an object can have different behaviors.

  • Dynamic Polymorphism

    • Polymorphism happens at runtime.
    • A key feature of object-orientation.
    • Based on interfaces and virtual methods.
    • Needs one indirection such as a reference or a pointer in C++.
  • Static Polymorphism

    • Polymorphism happens at compile-time.
    • Is not bound to interfaces or derivation hierarchies => Duck Typing
    • No indirection such as pointers or references required.
    • Static polymorphism is typically faster than dynamic polymorphism.

Get hands-on with 1200+ tech skills courses.