4 ms·
Not necessarily. std::function for example provides polymorphism of callables without inheritance. Type erasure can generally used for polymoprhism in C++. Al
by gpderetta 4y ago
Not necessarily. std::function for example provides polymorphism of callables without inheritance. Type erasure can generally used for polymoprhism in C++.
Also templates are of course polymorphic and do not require inheritance, but that's not runtime polymorphism which I guess was implied.
edit: s/is/can be/