討論串[問題] pure virtual destructor 怎宣告?
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁
內容預覽:
那只是說明用的,. 如果看相關的書,. 書上也會告訴你那只是寫來講解 compiler 行為用的 pseudo code。. 自己加沒有意義也不對。. 一般會明確呼叫 instance 的 destructor,. 是你想自己做記憶體管理的時候,. 通常那附近還看得到 placement new 的
(還有2238個字)
內容預覽:
L大說的其實我是知道 先問幾個問題~如下 手動加的話 那compiler會在幫你加嗎? 變成清兩次...我想是不會..... 因為我用VC手動寫 他不讓我呼叫~Base();. unary '~' : 'Base' does not define this operator or a convers
(還有961個字)
內容預覽:
又到了講觀念的時候~. Destructor 和 member function 有極大的不同,首先,你並不會「主動」呼叫. dtor,它總是由 compiler 在物件脫離它的 scope 時,或是使用者呼叫 delete 時,. 由 compiler 自動幫你呼叫的。(儘管你可以手動呼叫 dto
(還有1980個字)
內容預覽:
class A. {. public:. ........一些pure virtual function. virtual ~A() = 0;. };. 有其他class會繼承A. 其實我code中 class是寫interface 其實就是struct. 但他的destructor不給我宣告成pu
(還有199個字)
首頁
上一頁
1
下一頁
尾頁