{"id":452,"date":"2018-06-17T17:53:42","date_gmt":"2018-06-17T09:53:42","guid":{"rendered":"https:\/\/flandre-scarlet.moe\/blog\/?p=452"},"modified":"2025-05-25T01:43:25","modified_gmt":"2025-05-24T17:43:25","slug":"%e8%8f%b1%e5%bd%a2%e7%bb%a7%e6%89%bf%e7%9a%84%e5%86%85%e5%ad%98%e5%b8%83%e5%b1%80","status":"publish","type":"post","link":"https:\/\/flandre-scarlet.moe\/blog\/452\/","title":{"rendered":"\u83f1\u5f62\u7ee7\u627f\u7684\u5185\u5b58\u5e03\u5c40"},"content":{"rendered":"<p>\u83f1\u5f62\u7ee7\u627f\u6765\u81ea\u4e8e\u591a\u91cd\u7ee7\u627f\uff0c\u662f\u4e3a\u4e86\u89e3\u51b3\u5177\u6709\u6b67\u4e49\u7684\u7ec4\u5408\u800c\u4ea7\u751f\u7684\u4e00\u4e2a\u7ed3\u679c\u3002\u901a\u8fc7\u5f15\u5165\u865a\u7ee7\u627f\uff0c\u4f7f\u5f97\u591a\u4e2a\u7531\u865a\u57fa\u7c7b\u76f4\u63a5\u6216\u95f4\u63a5\u6d3e\u751f\u7684\u7c7b\u62e5\u6709\u4e00\u4e2a\u5171\u540c\u7684\u57fa\u7c7b\u5b9e\u4f8b\u3002\u5b9e\u73b0\u4e0a\u76f8\u5f53\u4e8e\u6d3e\u751f\u7c7b\u7ed5\u8fc7\u4e86\u7236\u7c7b\u76f4\u63a5\u7ee7\u627f\u4e86\u7956\u7236\u7c7b(\u865a\u57fa\u7c7b)\u3002<br \/>\n\u4e0b\u9762\u6211\u4eec\u901a\u8fc7 MSC 14 \u7f16\u8bd1\u5668\uff08VS2015\uff09\u6765\u770b\u4e00\u4e0b\u83f1\u5f62\u7ee7\u627f\u7684\u5b9e\u73b0\u7ec6\u8282\u3002<br \/>\n<!--more--><\/p>\n<p>\u7c7b\u7ee7\u627f\u7ed3\u6784\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nclass A0\r\n{\r\npublic:\r\n    virtual      ~A0()  { }\r\n    virtual void f()    = 0;\r\n    virtual void f2()   = 0;\r\n    int ma0;\r\n};\r\n\r\nclass A1\r\n{\r\npublic:\r\n    virtual      ~A1() { printf(&quot;%d&quot;, ma1); }\r\n    virtual void g()   = 0;\r\n    virtual void g2()  = 0;\r\n    int ma1;\r\n};\r\n\r\nclass B : virtual public A0, virtual public A1\r\n{\r\npublic:\r\n    virtual void f() { printf(&quot;B::f&quot;); }\r\n    virtual void b() { printf(&quot;B::b&quot;); }\r\n    int mb;\r\n};\r\n\r\nclass C : virtual public A0, virtual public A1\r\n{\r\npublic:\r\n    virtual void f() { printf(&quot;C::f&quot;); }\r\n    virtual void c() { printf(&quot;C::c&quot;); }\r\n    int mc;\r\n};\r\n\r\nclass D : public B, public C\r\n{\r\npublic:\r\n    virtual void f()  { printf(&quot;D::f&quot;);  }\r\n    virtual void f2() { printf(&quot;D::f2&quot;); }\r\n    virtual void g()  { printf(&quot;D::g&quot;);  }\r\n    virtual void g2() { printf(&quot;D::g2&quot;); }\r\n    virtual void b()  { printf(&quot;D::b&quot;);  }\r\n    virtual void c()  { printf(&quot;D::c&quot;);  }\r\n    virtual void d()  { printf(&quot;D::d&quot;);  }\r\n    int md;\r\n};\r\n<\/pre>\n<p>\u9996\u5148\u4f7f\u7528 -d1reportAllClassLayout \u7f16\u8bd1\u9009\u9879\u67e5\u770b\u4e00\u4e0b\u6240\u6709\u7c7b\u7684\u5185\u5b58\u5e03\u5c40\uff1a<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\nclass A0 size(8):\t\t\t\tclass A1 size(8):\r\n\t+---\t\t\t\t\t\t\t+---\r\n 0\t| {vfptr}\t\t\t\t\t 0\t| {vfptr}\t\t\/\/ A0\u3001A1 \u7684\u865a\u8868\u6307\u9488\r\n 4\t| ma0\t\t\t\t\t\t 4\t| ma1\t\t\t\/\/ A0\u3001A1 \u7684\u6210\u5458\r\n\t+---\t\t\t\t\t\t\t+---\r\n\r\nA0::$vftable@:\t\t\t\t\tA1::$vftable@:\r\n 0\t| &amp;A0::{dtor}\t\t\t\t 0\t| &amp;A1::{dtor}\t\/\/ \u5404\u81ea\u7684\u865a\u8868\u4ee5\u53ca\u51fd\u6570\u7684\u504f\u79fb\r\n 1\t| &amp;A0::f\t\t\t\t\t 1\t| &amp;A1::g\r\n 2\t| &amp;A0::f2\t\t\t\t\t 2\t| &amp;A1::g2\r\n \r\n\r\nclass B size(28):\t\t\t\tB::$vftable@B@:\t\t\/\/ B \u81ea\u8eab\u7684\u865a\u8868\r\n\t+---\t\t\t\t\t\t 0\t| &amp;B::b\r\n 0\t| {vfptr}\r\n 4\t| {vbptr}\t\t\t\t\tB::$vbtable@:\t\t\/\/ B \u7684\u865a\u57fa\u7c7b\u8868\uff0c\u7531\u504f\u79fb 4 \u5904\r\n 8\t| mb\t\t\t\t\t\t\t\t\t\t\t\/\/ \u7684 vbptr \u6307\u5411\r\n\t+---\t\t\t\t\t\t 0\t| -4\t\t\t\/\/ \u7b2c\u4e00\u9879\u4e3a\u81ea\u8eab(B) \u76f8\u5bf9\r\n\t+--- (virtual base A0)\t\t\t\t\t\t\t\/\/ \u4e8e vbptr \u7684\u504f\u79fb\uff0c\u5373\u4e3a 0\r\n12\t| {vfptr}\t\t\t\t\t 1\t| 8 (Bd(B+4)A0)\t\/\/ \u7b2c\u4e00\u4e2a\u865a\u57fa\u7c7b A0 \u7684\u504f\u79fb\uff0c12\r\n16\t| ma0\t\t\t\t\t\t 2\t| 16 (Bd(B+4)A1)\/\/ A1 \u7684\u504f\u79fb\uff0c20\r\n\t+---\t\t\t\t\t\t\r\n\t+--- (virtual base A1)\t\tB::$vftable@A0@:\t\/\/ B \u4e2d\u6765\u81ea\u4e8e A0 \u7684\u865a\u51fd\u6570\r\n20\t| {vfptr}\t\t\t\t\t 0\t| &amp;B::{dtor}\r\n24\t| ma1\t\t\t\t\t\t 1\t| &amp;B::f\r\n\t+---\t\t\t\t\t\t 2\t| &amp;A0::f2\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tB::$vftable@A1@:\t\/\/ B \u4e2d\u6765\u81ea\u4e8e A1 \u7684\u865a\u51fd\u6570\r\n\t\t\t\t\t\t\t\t 0\t| &amp;thunk: this-=8; goto B::{dtor}\r\n\t\t\t\t\t\t\t\t 1\t| &amp;A1::g\r\n\t\t\t\t\t\t\t\t 2\t| &amp;A1::g2\r\n\r\n\r\n\/\/ C \u540c B\r\nclass C size(28):\t\t\t\tC::$vftable@C@:\r\n\t+---\t\t\t\t\t\t 0\t| &amp;C::c\r\n 0\t| {vfptr}\r\n 4\t| {vbptr}\t\t\t\t\tC::$vbtable@:\r\n 8\t| mc\t\t\t\t\t\t 0\t| -4\r\n\t+---\t\t\t\t\t\t 1\t| 8 (Cd(C+4)A0)\r\n\t+--- (virtual base A0)\t\t 2\t| 16 (Cd(C+4)A1)\r\n12\t| {vfptr}\r\n16\t| ma0\t\t\t\t\t\tC::$vftable@A0@:\r\n\t+---\t\t\t\t\t\t 0\t| &amp;C::{dtor}\r\n\t+--- (virtual base A1)\t\t 1\t| &amp;C::f\r\n20\t| {vfptr}\t\t\t\t\t 2\t| &amp;A0::f2\r\n24\t| ma1\r\n\t+---\t\t\t\t\t\tC::$vftable@A1@:\r\n\t\t\t\t\t\t\t\t 0\t| &amp;thunk: this-=8; goto C::{dtor}\r\n\t\t\t\t\t\t\t\t 1\t| &amp;A1::g\r\n\t\t\t\t\t\t\t\t 2\t| &amp;A1::g2\r\n\r\n\r\n\r\nclass D size(44):\t\t\t\tD::$vftable@B@:\t\t\/\/ \u6765\u81ea B \u7684\u865a\u51fd\u6570\r\n\t+---\t\t\t\t\t\t 0\t| &amp;D::b\r\n 0\t| +--- (base class B)\r\n 0\t| | {vfptr}\t\t\t\t\tD::$vftable@C@:\t\t\/\/ \u6765\u81ea C \u7684\u865a\u51fd\u6570\r\n 4\t| | {vbptr}\t\t\t\t\t 0\t| &amp;D::c\r\n 8\t| | mb\r\n\t| +---\t\t\t\t\t\tD::$vbtable@B@:\t\t\/\/ B \u7684\u865a\u57fa\u7c7b\u8868\r\n12\t| +--- (base class C)\t\t 0\t| -4\r\n12\t| | {vfptr}\t\t\t\t\t 1\t| 24 (Dd(B+4)A0)\r\n16\t| | {vbptr}\t\t\t\t\t 2\t| 32 (Dd(B+4)A1)\r\n20\t| | mc\r\n\t| +---\t\t\t\t\t\tD::$vbtable@C@:\t\t\/\/ C \u7684\u865a\u57fa\u7c7b\u8868\r\n24\t| md\t\t\t\t\t\t 0\t| -4\r\n\t+---\t\t\t\t\t\t 1\t| 12 (Dd(C+4)A0)\/\/ \u8ba1\u7b97\u5f97\u5230\u7684 A0\u3001A1\r\n\t+--- (virtual base A0)\t\t 2\t| 20 (Dd(C+4)A1)\/\/ \u504f\u79fb\u4e0e B \u4e2d\u76f8\u540c\r\n28\t| {vfptr}\r\n32\t| ma0\t\t\t\t\t\tD::$vftable@A0@:\t\/\/ \u6765\u81ea A0 \u7684\u865a\u51fd\u6570\r\n\t+---\t\t\t\t\t\t 0\t| &amp;D::{dtor}\r\n\t+--- (virtual base A1)\t\t 1\t| &amp;D::f\r\n36\t| {vfptr}\t\t\t\t\t 2\t| &amp;D::f2\r\n40\t| ma1\r\n\t+---\t\t\t\t\t\tD::$vftable@A1@:\t\/\/ \u6765\u81ea A1 \u7684\u865a\u51fd\u6570\r\n\t\t\t\t\t\t\t\t 0\t| &amp;thunk: this-=8; goto D::{dtor}\r\n\t\t\t\t\t\t\t\t 1\t| &amp;D::g\r\n\t\t\t\t\t\t\t\t 2\t| &amp;D::g2\r\n<\/pre>\n<p>\u5bf9\u5404\u4e2a\u7c7b\u7684\u5185\u5b58\u5e03\u5c40\u6709\u4e86\u5927\u81f4\u7684\u4e86\u89e3\u540e\uff0c\u63a5\u4e0b\u6765\u6765\u770b\u4e00\u4e0b\u7c7b D \u7684\u6784\u9020\u548c\u6790\u6784\u7684\u60c5\u51b5\u3002<\/p>\n<h1>\u00b7\u6784\u9020<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n01392527  push  1\t\t\t\t\t\t; \u4f20\u5165 1\r\n01392529  mov   ecx,dword ptr &#x5B;ebp-0D4h]  \r\n0139252F  call  D::D (013911B8h)  \r\n\r\nD::D:\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u5165\u53e3\u4ee3\u7801\r\n01391B2F  pop   ecx\t\t\t\t\t\t; this \u6307\u9488\r\n01391B30  mov   dword ptr &#x5B;this],ecx\r\n01391B33  mov   dword ptr &#x5B;ebp-0D4h],0\r\n01391B3D  cmp   dword ptr &#x5B;ebp+8],0\t\t; \u4e3a 0 \u8df3\u8fc7\uff0c\u9632\u6b62\u91cd\u590d\u6784\u9020\u865a\u57fa\u7c7b\r\n01391B41  je    D::D+6Bh (01391B7Bh)\r\n01391B43  mov   eax,dword ptr &#x5B;this]\t; \u8bbe\u7f6e vbtable_B\r\n01391B46  mov   dword ptr &#x5B;eax+4],offset D::`vbtable' (01397C20h)\r\n01391B4D  mov   eax,dword ptr &#x5B;this]\t; \u8bbe\u7f6e vbtable_C\r\n01391B50  mov   dword ptr &#x5B;eax+10h],offset D::`vbtable' (01397C30h)\r\n01391B57  mov   ecx,dword ptr &#x5B;this]\r\n01391B5A  add   ecx,1Ch\t\t\t\t\t; \u4fee\u6b63\u504f\u79fb\u540e\u8c03\u7528\u6784\u9020\u51fd\u6570\r\n01391B5D  call  A0::A0 (01391087h)\r\n01391B62  or    dword ptr &#x5B;ebp-0D4h],1\r\n01391B69  mov   ecx,dword ptr &#x5B;this]\r\n01391B6C  add   ecx,24h\r\n01391B6F  call  A1::A1 (0139143Dh)\r\n01391B74  or    dword ptr &#x5B;ebp-0D4h],2\r\n01391B7B  push  0\t\t\t\t\t\t; \u4f20\u5165 0\uff0c\u9632\u6b62\u91cd\u590d\u6784\u9020\r\n01391B7D  mov   ecx,dword ptr &#x5B;this]\r\n01391B80  call  B::B (0139142Eh)\r\n01391B85  push  0\r\n01391B87  mov   ecx,dword ptr &#x5B;this]\r\n01391B8A  add   ecx,0Ch\r\n01391B8D  call  C::C (01391082h)\r\n01391B92  mov   eax,dword ptr &#x5B;this]\t; &lt;\u5f00\u59cb D \u81ea\u8eab\u7684\u6784\u9020&gt; \u8bbe\u7f6e vftable_B\r\n01391B95  mov   dword ptr &#x5B;eax],offset D::`vftable' (01397BE4h)\r\n01391B9B  mov   eax,dword ptr &#x5B;this]\t; \u8bbe\u7f6e vftable_C\r\n01391B9E  mov   dword ptr &#x5B;eax+0Ch],offset D::`vftable' (01397BF0h)\r\n01391BA5  mov   eax,dword ptr &#x5B;this]\r\n01391BA8  mov   ecx,dword ptr &#x5B;eax+4]\r\n01391BAB  mov   edx,dword ptr &#x5B;ecx+4]\r\n01391BAE  mov   eax,dword ptr &#x5B;this]\t; \u7531 B \u7684 vbptr \u53d6\u5f97 A0 \u7684\u865a\u8868\u6307\u9488\u5e76\u8d4b\u503c\r\n01391BB1  mov   dword ptr &#x5B;eax+edx+4],offset D::`vftable' (01397BFCh)\r\n01391BB9  mov   eax,dword ptr &#x5B;this]\r\n01391BBC  mov   ecx,dword ptr &#x5B;eax+4]\r\n01391BBF  mov   edx,dword ptr &#x5B;ecx+8]\r\n01391BC2  mov   eax,dword ptr &#x5B;this]\t; \u7531 B \u7684 vbptr \u53d6\u5f97 A1 \u7684\u865a\u8868\u6307\u9488\u5e76\u8d4b\u503c\r\n01391BC5  mov   dword ptr &#x5B;eax+edx+4],offset D::`vftable' (01397C10h)\r\n01391BCD  mov   eax,dword ptr &#x5B;this]\t; \u8fd4\u56de this\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u51fa\u53e3\u4ee3\u7801\r\n<\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0cD \u4e2d\u4fdd\u5b58\u4e86 4 \u4e2a\u7c7b\u5404\u81ea\u7684\u865a\u8868\uff0c\u6709\u4e86\u8fd9\u4e9b\u865a\u8868\uff0c\u53ef\u4ee5\u65b9\u4fbf\u7684\u5c06 D \u7c7b\u8f6c\u6362\u4e3a\u5bf9\u5e94\u7684\u7236\u7c7b\u6307\u9488\uff0c\u800c\u4e14\u5728\u8f6c\u4e3a\u7236\u7c7b\u65f6\uff0c\u5b50\u7c7b\u7ee7\u627f\u81ea\u5176\u5b83\u7236\u7c7b\u7684\u865a\u51fd\u6570\u88ab\u5c4f\u853d\uff0c\u65e0\u6cd5\u8c03\u7528\u3002<\/br>\u53e6\u5916\u5728\u8c03\u7528 D \u7684\u6784\u9020\u51fd\u6570\u4e2d\u4f20\u5165\u4e86\u4e00\u4e2a\u9690\u542b\u7684\u6807\u5fd7\u53c2\u6570\uff0c\u7528\u6765\u51b3\u5b9a\u662f\u5426\u8fdb\u884c\u865a\u57fa\u7c7b\u7684\u6784\u9020\uff0c\u4ee5\u6b64\u907f\u514d\u91cd\u590d\u6784\u9020\u7684\u95ee\u9898\u3002\u7531\u6b64\u4e5f\u53ef\u4ee5\u77e5\u9053\uff0c\u7c7b\u4e2d\u7684\u865a\u8868\u6307\u9488\uff0c\u4ee5\u53ca\u7c7b\u7684\u865a\u8868\u5e76\u4e0d\u662f\u552f\u4e00\u7684\uff0c\u9700\u8981\u786e\u8ba4\u5b83\u7684\u7ee7\u627f\u4f53\u7cfb\u3002\u5982\u679c D \u6709\u975e\u7ee7\u627f\u7684\u865a\u51fd\u6570\uff0c\u90a3\u4e48\u5b83\u5c06\u4f1a\u88ab\u8bb0\u5f55\u5230 D \u7684 vftable_B \u4e2d\u3002<\/p>\n<h1>\u00b7\u6790\u6784<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nD::`vector deleting destructor':\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u5165\u53e3\u4ee3\u7801\r\n01342010  mov   dword ptr &#x5B;this],ecx  \r\n01342013  mov   ecx,dword ptr &#x5B;this]  \r\n01342016  sub   ecx,1Ch\t\t\t\t\t; \u5c06 this \u4ece A0 \u8c03\u6574\u4e3a D\r\n01342019  call  D::`vbase destructor' (013410D7h)  \r\n0134201E  mov   eax,dword ptr &#x5B;ebp+8]  \r\n01342021  and   eax,1  \r\n01342024  je    D::`scalar deleting destructor'+47h (01342037h)  \r\n01342026  push  2Ch  \r\n01342028  mov   eax,dword ptr &#x5B;this]  \r\n0134202B  sub   eax,1Ch  \r\n0134202E  push  eax  \r\n0134202F  call  operator delete (01341055h)  \r\n01342034  add   esp,8  \r\n01342037  mov   eax,dword ptr &#x5B;this]\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u51fa\u53e3\u4ee3\u7801\r\n\r\nD::`vbase destructor':\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u5165\u53e3\u4ee3\u7801\r\n01341DA0  mov   dword ptr &#x5B;this],ecx  \r\n01341DA3  mov   ecx,dword ptr &#x5B;this]  \r\n01341DA6  add   ecx,1Ch\t\t\t\t\t; this \u6539\u4e3a A0\r\n01341DA9  call  D::~D (0134146Ah)  \r\n01341DAE  mov   ecx,dword ptr &#x5B;this]  \r\n01341DB1  add   ecx,24h  \r\n01341DB4  call  A1::~A1 (013410A0h)  \r\n01341DB9  mov   ecx,dword ptr &#x5B;this]  \r\n01341DBC  add   ecx,1Ch  \r\n01341DBF  call  A0::~A0 (01341456h)\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u51fa\u53e3\u4ee3\u7801\r\n\r\nD::~D:\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u5165\u53e3\u4ee3\u7801\r\n01341D40  mov   dword ptr &#x5B;this],ecx  \r\n01341D43  mov   ecx,dword ptr &#x5B;this]  \r\n01341D46  sub   ecx,4  \r\n01341D49  call  C::~C (0134132Ah)  \r\n01341D4E  mov   ecx,dword ptr &#x5B;this]  \r\n01341D51  sub   ecx,10h  \r\n01341D54  call  B::~B (013411D6h)\r\n....\t\t\t\t\t\t\t\t\t; \u7701\u7565\u51fd\u6570\u51fa\u53e3\u4ee3\u7801\r\n<\/pre>\n<p>\u6790\u6784\u8fc7\u7a0b\u4e2d\u76f4\u63a5\u5c06\u865a\u57fa\u7c7b\u7684\u8c03\u7528\u653e\u5728\u4e86\u6700\u540e\uff0c\u4f9d\u6b21\u6267\u884c\u7236\u7c7b\u7684\u6790\u6784\u4e4b\u540e\uff0c\u518d\u8c03\u7528\u865a\u57fa\u7c7b\u7684\u6790\u6784\u3002\u800c\u4e0d\u662f\u5c06\u5176\u5305\u542b\u5728\u7236\u7c7b\u4e2d\uff0c\u518d\u50cf\u6784\u9020\u7684\u65f6\u5019\u7528\u6807\u5fd7\u4f4d\u533a\u5206\u662f\u5426\u6784\u9020\u3002\u81ea\u7136\uff0cB\u3001C \u7684\u6790\u6784\u51fd\u6570\u5c31\u4e0d\u518d\u542b\u6709\u5bf9 AX::~AX \u7684\u8c03\u7528\u4e86\u3002<\/p>\n<p>\u6709\u8da3\u7684\u662f\uff0c\u5f53\u7ed9 C \u52a0\u4e0a\u6790\u6784\u51fd\u6570\u65f6\uff0c\u7c7b\u7684\u5e03\u5c40\u4f1a\u53d1\u751f\u53d8\u5316\u3002\u7f16\u8bd1\u5668\u4f1a\u5206\u522b\u5728\u539f\u5148\u7684\u57fa\u7840\u4e0a\uff0c\u5728 A0\u3001A1 \u524d\u52a0\u4e0a 4 \u5b57\u8282\u7684 vtordisp \u586b\u5145\uff0c\u53d8\u4e3a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n1&gt;\tclass D size(52):\r\n1&gt;\t\t+---\r\n1&gt;\t 0\t| +--- (base class B)\r\n1&gt;\t 0\t| | {vfptr}\r\n1&gt;\t 4\t| | {vbptr}\r\n1&gt;\t 8\t| | mb\r\n1&gt;\t\t| +---\r\n1&gt;\t12\t| +--- (base class C)\r\n1&gt;\t12\t| | {vfptr}\r\n1&gt;\t16\t| | {vbptr}\r\n1&gt;\t20\t| | mc\r\n1&gt;\t\t| +---\r\n1&gt;\t24\t| md\r\n1&gt;\t\t+---\r\n1&gt;\t28\t| (vtordisp for vbase A0)\t&lt;---\r\n1&gt;\t\t+--- (virtual base A0)\r\n1&gt;\t32\t| {vfptr}\r\n1&gt;\t36\t| ma0\r\n1&gt;\t\t+---\r\n1&gt;\t40\t| (vtordisp for vbase A1)\t&lt;---\r\n1&gt;\t\t+--- (virtual base A1)\r\n1&gt;\t44\t| {vfptr}\r\n1&gt;\t48\t| ma1\r\n1&gt;\t\t+---\r\n<\/pre>\n<p>\u67e5\u770b\u4e86\u4e00\u4e0b\u4f3c\u4e4e\u662f\u5728\u6790\u6784\u51fd\u6570\u4e2d\uff0c\u5177\u4f53\u6765\u8bf4\u662f\u5728 D::~D \u4e2d\uff08\u6b64\u65f6\u7684 this \u4e3a A0\uff09\u8c03\u7528 C::~C \u524d\u5c06 ecx \u8bbe\u7f6e\u4e3a vtordisp for vbase A0\uff0c\u968f\u540e\u5c06\u5176\u89c6\u4e3a this \u8fdb\u884c vptr \u4ee5\u53ca\u6210\u5458\u7684\u5b9a\u4f4d\u3002<\/p>\n<p><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ms879782.aspx\" rel=\"noopener\" target=\"_blank\">\u5fae\u8f6f\u7684\u89e3\u91ca<\/a>\u662f\u91cd\u5199\u4e86\u865a\u51fd\u6570\u5e76\u5728\u6784\u9020\/\u6790\u6784\u51fd\u6570\u91cc\u8c03\u7528\u4e86\u91cd\u5199\u7684\u51fd\u6570\u65f6\u4f1a\u63d2\u5165\u8fd9\u4e2a\u5b57\u6bb5\uff0c\u5b9a\u4e49\u4e86 D\uff08\u6216 B\u3001C\uff09\u7684\u6790\u6784\u51fd\u6570\u6ee1\u8db3\u4e86\u8fd9\u4e2a\u8981\u6c42\uff0c\u800c\u7f16\u8bd1\u5668\u81ea\u52a8\u751f\u6210\u7684\u6790\u6784\u51fd\u6570\u4f3c\u4e4e\u4e0d\u7b97\u5728\u5185\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u83f1\u5f62\u7ee7\u627f\u6765\u81ea\u4e8e\u591a\u91cd\u7ee7\u627f\uff0c\u662f\u4e3a\u4e86\u89e3\u51b3\u5177\u6709\u6b67\u4e49\u7684\u7ec4\u5408\u800c\u4ea7\u751f\u7684\u4e00\u4e2a\u7ed3\u679c\u3002\u901a\u8fc7\u5f15\u5165\u865a\u7ee7\u627f\uff0c\u4f7f\u5f97\u591a\u4e2a\u7531\u865a\u57fa\u7c7b\u76f4\u63a5\u6216\u95f4\u63a5\u6d3e&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/flandre-scarlet.moe\/blog\/452\/\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85],"tags":[7,38,39],"class_list":["post-452","post","type-post","status-publish","format-standard","hentry","category-programs","tag-c","tag-38","tag-39"],"_links":{"self":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts\/452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/comments?post=452"}],"version-history":[{"count":1,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts\/452\/revisions"}],"predecessor-version":[{"id":2174,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/posts\/452\/revisions\/2174"}],"wp:attachment":[{"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/media?parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/categories?post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flandre-scarlet.moe\/blog\/wp-json\/wp\/v2\/tags?post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}