I have two classes: Test1 and Test2. Test1 has a field of data type Test2, & vice versa. I need some help in avoiding the incomplete type error ("Error: field has incomplete type").
Test1.h
Test2.h
Test1.h
Code:
#ifndef _TEST1_
#define _TEST1_
#include "Test2.h"
using namespace std;
class Test1
{ public:
Test2 test2Obj;
}
#endif
Code:
#ifndef _TEST2_
#define _TEST2_
#include "Test1.h"
using namespace std;
class Test2
{ public:
Test1 test1Obj;
}
#endif
Comment