What will happen if I say delete this

Showing Answers 1 - 3 of 3 Answers

Amit Banerjee

  • Sep 1st, 2005
 

Delete this is not acceptable or possible since delete this means we are trying to delete the reference of the object and calling the function from the object itself. 
 
Its like Kalidas , trying to cut the same branch on which you are seating.

  Was this answer useful?  Yes

somaraj

  • Nov 7th, 2005
 

The most important point is , The way in which the object is created .

If the object is created on stack - the object will be destroyed twice resulting in crash . First time when delete this is called second time when the stack unwinds.

But if the object is created in heap - delete this may work but that should be the last line using the object.

  Was this answer useful?  Yes

harshi

  • Oct 20th, 2006
 

Amit Banerjee Wrote: Delete this is not acceptable or possible since delete this means we are trying to delete the reference of the object and calling the function from the object itself. 
 
Its like Kalidas , trying to cut the same branch on which you are seating.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions