strUCt C041
{
C041() : c_(0x01) {}
virtual void foo() { c_ = 0x02; }
char c_;
};
struct C100 : public virtual C041
{
C100() : c_(0x02) {}
char c_;
};
struct C101 : public virtual C041
{
C101() : c_(0x03) {}
char c_;
};
struct C110 : public C100, public C101
{
C110() : c_(0x04) {}
char c_;
};
PRINT_SIZE_DETAIL(C110)
The size of C110 is 16
The detail of C110 is 28 c3 45 00 02 1c c3 45 00 03 04 18 c3 45 00 01
C100,5 C101,5 C110,1 C041,5
ospt,4,11 m,1 ospt,4,6 m,1 m,1 vtpt,4 m1
C110 c110;
c110.c_ = 0x51;
c110.C100::c_ = 0x52;
c110.C101::c_ = 0x52;
c110.C041::c_ = 0x53;
c110.foo();
01 00423993 push 1
02 00423995 lea ecx,[ebp+FFFFF7F0h]
03 0042399B call 0041DE60
04 004239A0 mov byte ptr [ebp+FFFFF7FAh],51h
05 004239A7 mov byte ptr [ebp+FFFFF7F4h],52h
06 004239AE mov byte ptr [ebp+FFFFF7F9h],52h
07 004239B5 mov eax,dWord ptr [ebp+FFFFF7F0h]
08 004239BB mov ecx,dword ptr [eax+4]
09 004239BE mov byte ptr [ebp+ecx+FFFFF7F4h],53h
10 004239C6 mov eax,dword ptr [ebp+FFFFF7F0h]
11 004239CC mov ecx,dword ptr [eax+4]
12 004239CF lea ecx,[ebp+ecx+FFFFF7F0h]
13 004239D6 call 0041DF32
struct C041
{
C041() : c_(0x01) {}
virtual void foo() { c_ = 0x02; }
char c_;
};
struct C140 : public virtual C041
{
C140() : c_(0x02) {}
virtual void foo() { c_ = 0x11; }
char c_;
};
struct C141 : public virtual C041
{
C141() : c_(0x03) {}
virtual void foo() { c_ = 0x12; }
char c_;
};
struct C150 : public C140, public C141
{
C150() : c_(0x04) {}
virtual void foo() { c_ = 0x21; }
char c_;
};
PRINT_SIZE_DETAIL(C041)
PRINT_SIZE_DETAIL(C140)
PRINT_SIZE_DETAIL(C141)
PRINT_SIZE_DETAIL(C150)
The size of C041 is 5
The detail of C041 is f0 c245 00 01
The size of C140 is 14
The detail of C140 is 48 c3 45 00 02 00 00 00 00 44 c3 45 00 01
The size of C141 is 14
The detail of C141 is 58 c3 45 00 03 00 00 00 00 54 c3 45 00 01
The size of C150 is 20
The detail of C150 is 74 c3 45 00 02 68 c3 45 00 03 04 00 00 00 00 64 c3 45 00 01
C140,5 C141,5 C150,1 zero,4 C041,5
ospt,4,15 m,1 ospt,4,10 m,1 m,1 4 vtpt,4 m1
C150 obj;
PRINT_OBJ_ADR(obj)
obj.foo();
obj's addressis : 0012F624
00423F74 lea ecx,[ebp+FFFFF757h]
00423F7A call 0041DCA3
01 00426C00 push ebp
02 00426C01 mov ebp,esp
03 00426C03 sub esp,0CCh
04 00426C09 push ebx
05 00426C0A push esi
06 00426C0B push edi
07 00426C0C push ecx
08 00426C0D lea edi,[ebp+FFFFFF34h]
09 00426C13 mov ecx,33h
10 00426C18 mov eax,0CCCCCCCCh
11 00426C1D rep stos dword ptr [edi]
12 00426C1F pop ecx
13 00426C20 mov dword ptr [ebp-8],ecx
14 00426C23 mov eax,dword ptr [ebp-8]
15 00426C26 mov byte ptr [eax-5],21h
16 00426C2A pop edi
17 00426C2B pop esi
18 00426C2C pop ebx
19 00426C2D mov esp,ebp
20 00426C2F pop ebp
21 00426C30 ret
C150 * pt = &obj;
pt->foo();
01 00423F8B mov eax,dword ptr [ebp+FFFFF73Ch]
02 00423F91 mov ecx,dword ptr [eax]
03 00423F93 mov edx,dword ptr [ecx+4]
04 00423F96 mov eax,dword ptr [ebp+FFFFF73Ch]
05 00423F9C mov ecx,dword ptr [eax]
06 00423F9E mov eax,dword ptr [ebp+FFFFF73Ch]
07 00423FA4 add eax,dword ptr [ecx+4]
08 00423FA7 mov ecx,dword ptr [ebp+FFFFF73Ch]
09 00423FAD mov edx,dword ptr [ecx+edx]
10 00423FB0 mov esi,esp
11 00423FB2 mov ecx,eax
12 00423FB4 call dword ptr [edx]
13 00423FB6 cmp esi,esp
14 00423FB8 call 0041DDF2
C141 * pt1 = dynamic_cast(pt);
pt1->foo();
01 00423FBD cmp dword ptr [ebp+FFFFF73Ch],0
02 00423FC4 je 00423FD7
03 00423FC6 mov eax,dword ptr [ebp+FFFFF73Ch]
04 00423FCC add eax,5
05 00423FCF mov dword ptr [ebp+FFFFF014h],eax
06 00423FD5 jmp 00423FE1
07 00423FD7 mov dword ptr [ebp+FFFFF014h],0
08 00423FE1 mov ecx,dword ptr [ebp+FFFFF014h]
09 00423FE7 mov dword ptr [ebp+FFFFF730h],ecx
01 00423FED mov eax,dword ptr [ebp+FFFFF730h]
02 00423FF3 mov ecx,dword ptr [eax]
03 00423FF5 mov edx,dword ptr [ecx+4]
04 00423FF8 mov eax,dword ptr [ebp+FFFFF730h]
05 00423FFE mov ecx,dword ptr [eax]
06 00424000 mov eax,dword ptr [ebp+FFFFF730h]
07 00424006 add eax,dword ptr [ecx+4]
08 00424009 mov ecx,dword ptr [ebp+FFFFF730h]
09 0042400F mov edx,dword ptr [ecx+edx]
10 00424012 mov esi,esp
11 00424014 mov ecx,eax
12 00424016 call dword ptr [edx]
13 00424018 cmp esi,esp
14 0042401A call 0041DDF2
新闻热点
疑难解答