Deleting C++ pointers to an object

前端 未结 9 1205
攒了一身酷
攒了一身酷 2021-01-26 20:06

I thought that the delete command would free up memory I allocated. Can someone explain why it seems I still have the memory in use after delete?

class Test
{
pu         


        
9条回答
  •  -上瘾入骨i
    2021-01-26 20:25

    Dereferencing a pointer to an object that has been deleted is undefined. The memory for that object probably hasn't been overwritten yet so your object is still there (If it works at all).

提交回复
热议问题