Hacker News new | ask | show | jobs
by bfrog 19 days ago
C++ the good parts is essentially C. If C had the concept of traits and generics or something like them like Rust there’d be no need for C++ and its ideas of mediocre inheritance and macros (templates).
1 comments

Tbf, I'd say Rust's concepts of Trait Objects and Generics are better implementations (in general) of C++'s inheritance and templates, respectively, rather than entirely different things. I'd also add constexpr/const blocks to good ideas to add, or else generics/templates will be abused (yet again).
There is no inherit in Rust. If you choose to try and do OOP horror Rust makes this fairly painful
I know. I mentioned C++ inheritance because it's its default dynamic dispatch mechanism that I'm aware of.