News for hackers. Stuff that matters.
Re:Inheritance versus Composition by umvi on Thursday May 09, 2019 @10:22AM (#19868532)
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.

Re:Inheritance versus Composition by batty_alex on Thursday May 09, 2019 @10:32AM (#19868618)
You 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#.