Right before class TestA put this line class TestB;
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Well it won't because it doesn't know what TestB is yet.
class TestB;
class TestA {
// stuff
};
class TestB {
// stuff
};
// methods
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
Well the classes themselves go in
TestA.h and TestB.h
The actual implementations go in
TestA.cpp and TestB.cpp
Further, when you do something like
b->id
within an 'A' member function, you should really use something like
b->getID()
so that later on, when you make all the data private, your code will still work.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
You didn't follow my replies.
ONE of your header files needs the class forward declaration.
AND both of them should NOT include the other.
In my original example, TestB.h could include TestA.h, but not vice-versa.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953