????c++?е???????????
???????????? ???????[ 2013/5/24 9:53:45 ] ????????
??????????main?????е?????
_main PROC
; 16 : int main() {
push ebp
mov ebp?? esp
sub esp?? 24 ; ?x1 x2???24byte????
; 17 : X x1;//????????x1
lea ecx?? DWORD PTR _x1$[ebp];???x1??????????????????????????????
call ??0X@@QAE@XZ;???ù?????
; 18 : X x2 = x1;//??x1??????x2
lea eax?? DWORD PTR _x1$[ebp];???x1????????????????eax
push eax;??eax???????????????????????????????????????
lea ecx?? DWORD PTR _x2$[ebp];???x2??????????????????????????????????????????????
call ??0X@@QAE@ABV0@@Z;?????????????
; 19 : }
xor eax?? eax
mov esp?? ebp
pop ebp
ret 0
_main ENDP
??????????????????X??????????????????????
??0X@@QAE@ABV0@@ZPROC ; X::X?? COMDAT
; _this$ = ecx
push ebp
mov ebp?? esp
push ecx;??????????this(??x2??????)?????
mov DWORD PTR _this$[ebp]?? ecx;ecx???溬??x2????????????????????????
mov eax?? DWORD PTR _this$[ebp];??x2????????eax
mov ecx?? DWORD PTR ___that$[ebp];??x1????????ecx
mov edx?? DWORD PTR [ecx];??x1????????????д??edx??????x1?е???????iд??edx
mov DWORD PTR [eax]?? edx;??edx???д??x2????????????edx???д??x2????????i
mov eax?? DWORD PTR _this$[ebp];??x2??????д??????eax
mov ecx?? DWORD PTR ___that$[ebp];??x1??????д??????ecx
mov edx?? DWORD PTR [ecx+4];?????x1????4byte?????????????д??edx??????x1????????j???д??edx
mov DWORD PTR [eax+4]?? edx;??edx???д?????x2????4byte??????棬????edx???д??x2????????j
mov eax?? DWORD PTR ___that$[ebp];??x1??????????????eax
add eax?? 8;//??x1????????8?????x1?г??????y??????????????eax??
push eax;??eax?????????????ó??????y??????????????
mov ecx?? DWORD PTR _this$[ebp];??x2??????????????ecx
add ecx?? 8;??x2????????8?????x2?г??????y????????????ecx??????????????????????????????????????????????
call ??0Y@@QAE@ABV0@@Z ; ???ó??????y???????????
mov eax?? DWORD PTR _this$[ebp];??x2??????????eax?????????????????????????????????
mov esp?? ebp
pop ebp
ret 4
??0X@@QAE@ABV0@@Z ENDP
????????????????????????X??????????????????x1?е???????i??j??????x2?У?????????ó??????y???????????????y?е?????????????в?????????У???????????????????????????????????е?????????????????????????????????????????????????????????????????????λ???й??????????X????????y????????i??j????壬?????????????????????????i??j????????á?
????????????Y?е????????????????
??0Y@@QAE@ABV0@@ZPROC ; Y::Y?? COMDAT
; _this$ = ecx
; 6 : Y(const Y& y) {}
push ebp
mov ebp?? esp
push ecx;??ecx????????????this(x2?г??????y??????)?????
mov DWORD PTR _this$[ebp]?? ecx;ecx??????x2?г??????y????????????????????
mov eax?? DWORD PTR _this$[ebp];??x2?г??????????????eax????????????????????????????????
mov esp?? ebp
pop ebp
ret 4
??0Y@@QAE@ABV0@@Z ENDP
??????????п??????????????Y?????????????????????????????????????????????????κε????????????????Y?У?????????????????????????????
??????????????????????????п????????????
??????????c++???
class Y {
private:
int j;
};
class X {
private:
int i;
int j;
Y y;
};
int main() {
X x1;//????????x1
X x2 = x1;//??x1??????x2
}
??????
![](/images/ad-banner/ad-banner.png)
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11