批踢踢實業坊
›
看板
C_and_CPP
關於我們
聯絡資訊
返回看板
作者
adrianshum (Alien)
看板
C_and_CPP
標題
Re: [問題] 這樣 delete 有問題嗎?
時間
Tue Mar 3 14:28:10 2009
※ 引述《katanashi (katanashi)》之銘言:
: char *pBuf = (char *)new MyStruct();
: .....
: delete pBuf; // <--- OK or not ?
: 這樣能正確釋放記憶體嗎?
應該不能了. 要是這樣也能正常 delete, 也不需要 virtual destructor 了吧?!... --
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 202.155.236.82