C++??????????????????
???????????? ???????[ 2012/9/12 10:18:50 ] ????????
???????????
????A?????B??????????B???????A??????
??????????????
????1????????
????A???????B????B????????A??????????γ??????
#include "B.h" class A { int i; B b; }; #include "A.h" class B { int i; A a; }; |
????2???????д????????????
????1????????????????b.h ????????b.h?а?????a.h
????2??a.h?в????????b.h?????????class b??????????????????????????b
????3??????class b ????а??????? "b.h"????????????? b?????????????????????????????????
??a.h:
#include <iostream> using namespace std; class b; class a { public: b *ib; void putA() { cout<<"????A??"<<endl; } }; |
b.h:
#include <iostream> #include "a.h" using namespace std; class b { public: a ia; void putB() { cout<<"????B??"<<endl; } }; |
????????
#include <stdio.h> #include <tchar.h> #include "b.h" int _tmain(int argc, _TCHAR* argv[]) { b B; B.putB(); B.ia.putA(); getchar(); return 0; } |
??????
???·???
??????????????????
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