轉(zhuǎn)載:
http://www.artima.com/cppsource/pure_virtual.htmlWhen you construct an instance of a derived class, what happens, exactly? If the class has a
vtbl, the process goes something like the following:
Step 1: Construct the top-level base part:.
- Make the instance point to the base class's vtbl.
- Construct the base class instance member variables.
- Execute the body of the base class constructor.
Step 2: Construct the derived part(s) (recursively):
- Make the instance point to the derived class's vtbl.
- Construct the derived class instance member variables.
- Execute the body of the derived class constructor.
Destruction happens in reverse order, something like this:
Step 1: Destruct the derived part:
- (The instance already points to the derived class's vtbl.)
- Execute the body of the derived class destructor.
- Destruct the derived class instance member variables.
Step 2: Destruct the base part(s) (recursively):
- Make the instance point to the base class's vtbl.
- Execute the body of the base class destructor.
- Destruct the base class instance member variables.
posted @
2010-08-16 18:57 Uniker 閱讀(1428) |
評論 (0) |
編輯 收藏
問題描述:在編譯的時候出現(xiàn)__none_rtti_object異常
解決方法:
編譯器開啟支持運行時刻識別/GR,/GR(啟用運行時類型信息)
Vs2003 如何打開C++的RTTI機(jī)制
說明:此選項 (/GR) 添加代碼以便在運行時檢查對象類型。當(dāng)指定此選項時,編譯器定義 _CPPRTTI 預(yù)處理器宏。默認(rèn)情況下,此選項被清除 (/GR–)。
在 Visual Studio 開發(fā)環(huán)境中設(shè)置此編譯器選項
1. 打開此項目的“屬性頁”對話框。
2. 單擊“C/C++”文件夾。
3. 單擊“語言”屬性頁。
4. 修改“啟用運行時類型信息”屬性。
posted @
2010-06-21 14:45 Uniker 閱讀(1149) |
評論 (0) |
編輯 收藏
終于有了自己的技術(shù)博客了,以往寫代碼的時候總是有一些問題解決了就沒有記錄下來,后來重新碰到此類問題又得重頭開始解決,很是惱火。希望在以后的開發(fā)中能夠?qū)⑺鶎W(xué)、所感能夠記錄于此。
同時希望能夠與大家同進(jìn)步
posted @
2010-03-31 11:15 Uniker 閱讀(187) |
評論 (0) |
編輯 收藏