<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 多重繼承的先后問題 當前實例是CBase的“孫子”,而“父親”有2個,每個“父親”都將“爺爺”復制了一份。如果不指定哪個“父親”的“父親”,默認將第一個繼承的“父親”的“父親”當作“爺爺” <details> <summary>main.cpp</summary> ``` #include <iostream> #include <string> using namespace std; class CBase { public: string id; }; class CDerive1 : public CBase { public: void show1() { cout << "CDerive1: " << id << endl; } }; class CDerive2 : public CBase { public: void show2() { cout << "CDerive2: " << id << endl; } }; class CSon : public CDerive2, public CDerive1 { }; int main() { CSon s; s.CDerive1::id = "CDerive1"; s.CDerive2::id="CDerive2"; s.show1(); // CDerive1 s.show2(); // CDerive2 return 0; } ``` </details> <br/> ## 實例地址的調查 由于2個“父親”因而復制出2個“爺爺”,2個“爺爺”的地址也不同 ## 虛繼承 “虛繼承”就是在實例中,基類不管繼承多少個,只復制一份。 <details> <summary>main.cpp</summary> ``` #include <iostream> #include <string> using namespace std; class Base { public: string id; }; class A:virtual public Base { public: void show() { cout<< id<<endl; } }; class B:virtual public Base { public: void show() { cout <<id<<endl; } }; class C : public A, public B { }; int main() { C c; c.A::id="a-id"; c.B::id="b-id"; c.A::show(); c.B::show(); cout <<c.id<<endl; /** b-id b-id b-id */ return 0; } ``` </details> <br/>
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看