explicit call to destructor is not destroying my object why?

前端 未结 7 493
我寻月下人不归
我寻月下人不归 2020-12-03 08:56

I\'m calling the destructor to deallocate memory but it is not deleting my object. What is the reason behind it?

my code is like this:

class A
{
publ         


        
7条回答
  •  有刺的猬
    2020-12-03 09:55

    Why wouldn't? Your object has been destroyed but its memory space is still around until it goes out of scope, where it will be destroyed again by the way. It's undefined behavior to do what you do.

提交回复
热议问题