myclass *pMyclass = new myclass(x);
delete pMyclass; //it will excute ~myclass() first, then delete the space for the allocated space for this class.
(My bug in deleting pMyclass is not because this class. The reason is that I allocated space not correctly for space not related to this class)
delete会去调用被delete的指针所指向对象的析构函数来释放内存,而通常我们会在析构函数中使用delete,在本对象被析构之前先把对象里使用new实例化的一些对象析构,防止内存泻漏。