News for hackers. Stuff that matters.
Re:If Inheritance is so bad, why does everyone use it? by Kranar on Thursday April 11, 2024 @04:49PM (#40006672)
C++ templates are a form of duck typing as well, and combined with type erasure give you a lot of the benefits of OO without the downsides.
Re:If Inheritance is so bad, why does everyone use it? by michaelrpeskin on Thursday April 11, 2024 @05:02PM (#40006774)
Yes, you're right. I've done that in high-performance code where I couldn't afford the double function call of a virtual function. I forgot about that.
Re:If Inheritance is so bad, why does everyone use it? by jpc0 on Friday April 12, 2024 @05:59AM (#40010956)
Likewise this is getting easier with the auto keyword now being sugar for templates when used in function arguments and return values