C++17 gives us std::variant<> which allows for a new form of runtime polymorphism.
Polymorphism Polymorphism
by Adi Shavit
From the article:
Polymorphism allows manipulating different types identically when they implement the same interface.
C++ supports both static and dynamic polymorphism.
Dynamic run-time polymorphism in C++ is achieved using sub-typing with inheritance and virtual functions. This is the way it has always been in C++: Polymorphism ⇒ Heap-allocated objects.C++17 gives us std::variant<> which allows for a new form of runtime polymorphism.
Add a Comment
Comments are closed.