What happens if you call delete this in the destructor?
delete essentially performs 2 operations:
1. explicit call of the object destructor and
2. freeing up the memory occupied by the object
So calling in the destructor delete this will lead to an infinite loop, which, in turn, will lead to a stack overflow and the program will crash.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes