Well, yes I believe it is your code... at least the code of a C# developer. :-)
If you have 2 classes that reference each other, a couple of techniques you likely want to learn are:
(1) use of .cpp and .h files, with the class definition in the header file and the implementation in the .cpp file. Usually, one pair of files per class.
(2) forward definitions. You will use this technique in at least one of your header files.
If you declare a forward pointer to a class, you can create a pointer to that class before the class is defined.
If you define a class's interfaces (ie. the data and methods) before those methods are implemented, you can write code that calls them. ... oh yeah, then you can write the methods.
If you define and implement a class in one place (as you did, which is the C# style), then the compiler can (and usually does) consider that all of the methods are to be 'inline'. You typically don't want this, except for accessors or very short methods with trivial to simple logic. Generally you want to use both a header and implementation file for a given class. There are exceptions to this but they are relatively rare.
Here is some sample code (which I created by hand and didn't compile, if any errors are present).
class B;
class A
{
public:
A(B* b) { m_b = b; }
void foo();
private:
B* m_b;
};
#include "ClassA.h"
#include "ClassB.h"
A::foo()
{ m_b->bar(); }
class A;
class B
{
public:
B(A* a) { m_a = a; }
void bar();
private:
A* m_a;
};
#include "ClassB.h"
#include "ClassA.h"
void B::bar()
{
m_a->foo();
}
This code defines two classes that can reference each other. Hopefully you know how to turn the crank the rest of the way...