Calling new in a constructor, good or bad?

Started by
9 comments, last by Antheus 14 years ago
Quote:Original post by DieterVW
Anthes' design is fine too, though the example forgets to release() the auto_ptr's hold on the variables before the constructor ends - there by freeing the memory too soon. But that is easily remedied.


My bad, should be release(), not just plain assignment.

        heapObj = a.release();        safeObj = b.release();

This topic is closed to new replies.

Advertisement