Https://ide.codingblocks.com/#/s/8062

https://ide.codingblocks.com/#/s/8062
why does this code printing out destroying the car dynamic tesla car since the dynamic object (dynamic tesla car ) is deleted by delete command .why does it print the statement of the destructor?

when the static car object is deleted then the destructor is called but if the car is made dynamically it is not destroyed by when u use the delete to delete the dynamic allocated car destructor will be call again

1 Like