|
-
November 21st, 2007, 03:37 PM
#3
Re: What will happen if I say delete this
Graham is correct. And actually, if you call this in a non-member function you will get a compiler error as well. 
Anyways...
If the object was allocated on the heap... It will call it's destructor, then free it. (And that's assuming the delete call matches the new call)
If it's an object on the stack, it will call the destructor.... And depending on the allocator used for new/delete calls when you call delete, this could crash, it might not. If this is a POD (plain old data) object, it probably will have no apparent effect if it does not crash on the delete call.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|