中文字幕精品亚洲无线码,99视频在线观看精品29,亚州十八禁免费不卡在线视颖,亚洲香蕉网久久综合影视

<sub id="xxpls"></sub><sub id="xxpls"></sub>

  • <listing id="xxpls"><u id="xxpls"></u></listing>
    <sub id="xxpls"></sub>

  • <sub id="xxpls"><ol id="xxpls"></ol></sub>
    <style id="xxpls"><u id="xxpls"></u></style>
  •  找回密碼
     注冊

    QQ登錄

    只需一步,快速開始

    構(gòu)造函數(shù)與析構(gòu)函數(shù)調(diào)用順序

    [復制鏈接]
    1#
    發(fā)表于 2008-9-29 20:23:51 | 只看該作者 |倒序瀏覽 |閱讀模式
    <P>派生類與基類中<FONT color=#0000ff>構(gòu)造函數(shù)的調(diào)用順序</FONT>是<FONT color=#ff0000>先調(diào)用基類</FONT>的構(gòu)造函數(shù)對基類成員進行初始化。然<FONT color=#ff0000>后執(zhí)行派生類</FONT>的構(gòu)造函數(shù),如果基類仍是派生類,則這個過程遞歸進行。</P>+ Z* ~# }9 }: L# E$ |
    <P>當派生類還<FONT color=#ff0000>包括對象成員</FONT>時,則<FONT color=#0000ff>基類</FONT>的<FONT color=#ff0000>構(gòu)造函數(shù)先被調(diào)用</FONT>,<FONT color=#0000ff>對象成員</FONT>的構(gòu)造函數(shù)<FONT color=#0000ff>次之</FONT>,<FONT color=#ff0000>最后執(zhí)行派生類</FONT>的<FONT color=#0000ff>構(gòu)造函數(shù)</FONT>。在有<FONT color=#ff0000>多個</FONT><FONT color=#0000ff>對象成員</FONT>的情況下,這些對象成員的<FONT color=#ff0000>調(diào)用順序取決于</FONT>它們在派生類中<FONT color=#ff0000>被說明</FONT>的順序。</P>
    & v5 L, Q1 s* i! Q# K9 C9 u<P>派生類與基類中<FONT color=#0000ff>析構(gòu)函數(shù)</FONT>的調(diào)用順序與上面的執(zhí)行構(gòu)造函數(shù)的順序正好相反。即<FONT color=#ff0000>先執(zhí)行派生類</FONT>的析構(gòu)函數(shù),<FONT color=#ff0000>再調(diào)用基類</FONT>的析構(gòu)函數(shù)。</P>
    " p7 V6 Z. i, k$ R/ G4 M% O<P>多重繼承的構(gòu)造函數(shù)與析構(gòu)函數(shù)調(diào)用順序沒有作要求,但是我們還是了解一下,這種情況下,基類構(gòu)造函數(shù)執(zhí)行順序按它們被繼承時說明的順序依次調(diào)用,與它們在被始化列表中的順序無關(guān)。</P>
    您需要登錄后才可以回帖 登錄 | 注冊

    本版積分規(guī)則

    QQ|本地廣告聯(lián)系: QQ:905790666 TEL:13176190456|Archiver|手機版|小黑屋|汶上信息港 ( 魯ICP備19052200號-1 )

    GMT+8, 2025-8-12 11:47

    Powered by Discuz! X3.5

    © 2001-2025 Discuz! Team.

    快速回復 返回頂部 返回列表