I have 3 class in 3 files
But this fails at cout unexpectedlyCode://file1.h typedef struct { int a; double b; } A; class B { public: A*pA; void somefunc(int a){ pA->a=a;} }; //file2.h class C { public: B*pB; void somefunc(int b){pB->pA->b=b;} }; //file 3 #include "file1.h" #include "file2.h" #include < iostream> using namespace std; int main() { B rB; rB.somefunc(1); C rC; rC.somefunc(2); cout<<rC.pB->pA->a<<rC.pB->pA->b; }
Someone offer me a helping hand please/////
Thank you





Reply With Quote