???C++????????
???????????? ???????[ 2013/4/11 10:19:27 ] ????????
???????????????C++????????????????????????????????????????C++???????C++??????????????и?NOIP???????????STL????????C++?????????????????????????????????и?NOIP?????C++???????c??????cout??cin??
????????????????????????????????????ЩC++???????????????????????????????????????????????????????????????????????????????????????????????????????C++????????????????????????????C++????????
?????????
??????????????????????????п????????????μ????
????????????????????
1: class Father
2: {
3: int iA_;
4: int iB_;
5:
6: void FuncA();
7: void FuncB();
8: };
9:
10: class Child : Father
11: {
12: int iC_;
13: void FuncC();
14: };
???????Father??????????? (???? –> ????) : iA_??iB_????????Father??????С??8????????????????????????
???????????
???????????????????????????????????????????
????????????????????????????λ?????????????????????????? call ???????(???)????????????????????????????( ?????????λ??????? )??
???????????????????????????????????????????????飬???ж????????????е????????????“???”????????????????????????????????“???”????????????????????????????????????
????????????????С???????????????????????????????????????????????????????????????????????????????????
????this???
??????????????????????????????????????????
??????????????????????????????????????????????λ????????????
??????????п???????this???????????????????????????????
????????????????????????????????????????????????????ecx?????????????????????this???
??????????????????????????дthis?????????????????????????????????????????“????”??
??????л???
??????????????????????????????????ж???????????????????????????????????????????????е?????????з??????????????
1: #include <stdio.h>
2:
3: class Exp
4: {
5: int iA_;
6: int iB_;
7:
8: public:
9: Exp()
10: {
11: iA_ = iB_ = 0;
12: }
13: void Out()
14: {
15: printf("%d %d
"??iA_??iB_);
16: }
17: };
18:
19: int main()
20: {
21: Exp oA;
22: void *pC = &oA;
23:
24: oA.Out();
25: *(int*)pC = 1;
26: *(int*)((int)pC+4) = 2;
27: oA.Out();
28:
29: return 0;
30: }
?????????? 0 0
???????????? 1 2
??????? iA_??iB_????е??????????????????????????????????????????£?????? oA.iA_ = 1 ???????????
??????
???·???
??????????????????
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