C++???????????????Mereology??
???????????? ???????[ 2014/9/30 11:21:20 ] ????????C++ ???? NET
????Stroustrup ?????????????????????? Kierkegaard (?????????????????????????????? Stroustrup ???飬???????????????????????????????C++??????????C++????????д????????????????????о????????? ?????? ?????????C++????? Stroustrup ?????
?????л??????????C++????????????????C++??????????????????ж??????????????????????????????????C++?????????????????????C++?????????????????????????????????????????????????C++?????
?????????????????
????C++?????“δ???”????
????C++???????????????????????scope?????????????
?????洢?????storage class??
????????Σ?data segment??????
?????????stack?? ????
?????????heap?? ???????????????????
???????÷?Χ??scope??:
????1?????????? :: namespace??
????2????????? named namespace??
????3?????????anonymous namespace???????????
????4???? ??static class variable or type variable??
????5???????instance class member variable??
????6???????? - ??? ??static variable in a function??
????7??????????????????- ??? ??auto variable or stack variable??
????????????
??????????????????global
????????饗code block??: auto
????New/delete: free
?????????????????????: static in function
?????????
???????????
??????????
???????????
??????????
???????????
??????????Mereology??
???????whole variable??????
???????part variable?? ???????????????
??????????????????????????壬???????????????????????????
????????“?????”??????????????Mereology?????????????????????????????????????????????????????????
?????????????“????”??“????”?????????????????????????????????????????????????
???????????????????????????????????????
????A?? ????????????????壬???????κα??????????“?????”
????B?? ?????????????????壬???????????????????“?????”
???????????????????????????????????
????1?? ????洢????? Heap ????????????????
????A* pA = new A; //line1
????pA???????????????????heap?У??????“???Heap???”??
???????A??????? class A { B b??}?????line1???????????b??洢??????Heap.
?????????????????Heap?е???????????????????????????????????
????2?? ???????洢????????????????洢????
???????? class A { }?? class B { A *pA; }??foo????{B b??}
????b ???????????洢????????????????????? pA????????С????B *b = new B????? pA ???????? Heap??
????3?????????????????????????????????“??”???????????/д?????????????????е?????????“??”??????????????????????????á?
????????b.f1?????????b+offsetof(f1)?? f1?????????“??????”??
???????
???????C++????????????????????????C++?????????C++?????????????????“?????”?????????????????????????С?????????????
??????
???·???
??????????????????
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