Hacker News new | ask | show | jobs
by zabzonk 1262 days ago
in c++ you probably never want to write 'new MyObject()' at all. perhaps you didn't learn c++ from a good book?
2 comments

Depends more on when you learned C++. C++11 didn’t immediately replace C++98…
to whoever downvoted this, why would you write 'new MyObject()'?
I didn’t downvote and I don’t know C++, but I thought that the new and delete operators are how you manage dynamic memory allocation.

Is it not the way?

no, it really isn't. mostly you don't need to manage objects dynamically at all (make them automatic) but if you do, use something like std::make_unique(...)