Comment on Never trust a programmer who says he knows C++parentComments−Todd16yWhat about SomeComplexObject b = new SomeComplexObject() This should probably be SomeComplexObject* b = new SomeComplexObject() since the former news up an object and then invokes a copy constructor before losing the original reference and leaking.−masterj16yIt's also missing a semicolon.−wheels16yI omitted the lines that were completely wrong, like that one. That assignment wouldn't compile at all.−Todd16yGood points (wheels and masterj)
Comments
What about
This should probably be since the former news up an object and then invokes a copy constructor before losing the original reference and leaking.It's also missing a semicolon.
I omitted the lines that were completely wrong, like that one. That assignment wouldn't compile at all.
Good points (wheels and masterj)