I'm wondering how to stop/cancel the creation of an object, risen by new()
. Maybe if some preconditions fail and the object isn't needed.
- Check before
new
? - Check within constructor, returning
null
or something special, don't know how to handle ... - Check after
new
was successful and object is alive. Call a member functionmyObj->Init()
. And destroy object if this fails?