Search⌘ K

Polymorphism

Explore how std::variant enables polymorphism for unrelated types in C++17. Learn to use visitors with std::visit to dispatch methods and add new features without modifying existing types.

We'll cover the following...

Most of the time in C++, we can safely use runtime polymorphism based on a vtable approach. You have a collection of related types that share the same interface, and you have a ...