Wednesday, December 1, 2010

Deleting this

Given the statement: delete this; If the object was a global, static or local object, then it is deleted twice. Once during the call to

"delete this" and once when the object goes out of scope. If the object is created with "new" and is not deleted with "delete", it

will only be deleted once, but this would be another bug.

1 comment:

  1. Wrong, as is described. Why pointer gets deleted when leaving scope?

    ReplyDelete