4 ms·
Seems like in some languages, inheritance is not optional if you want to use polymorphism. AFAIK in C++ you must use inheritance if you want polymorphism since
by umvi 8y ago
Seems like in some languages, inheritance is not optional if you want to use polymorphism.
AFAIK in C++ you must use inheritance if you want polymorphism since there is no real concept of interfaces.
- batty_alex 8y agoYou can use templates to perform static polymorphism and duck-type the calls. If you want to do things the Java or C# way, then you're correct. You'd want a pure virtual interface, which mimics what you'd get with Java or C#.