I have three classes, class A, class B, and class C.

Each class is in its own file.
Class A uses class B. (object class)
Class B uses class A. (object class)
Class C uses class A and class B. (program class)

How do I go about using #include and/or prototypes so that this chain works?

> Class A uses class B. (object class)
> Class B uses class A. (object class)
One of these will have to contain only a POINTER to the other one.

class A {
  B b;
};
class B {
  A a;
};

You just end up with a.b.a.b.a.b.a.b.a.b.a.b.a.b and so on filling up the universe.

Making one of them a pointer to the other breaks the cycle.

class B; // class forward declaration
class A {
  B *b;
};
class B {
  A a;
};

No, because a->b requires you to actually run some code along the lines of

a->b = new B;
or something.

It's like a linked list, which points to itself.
Whereas this is an alternating pair of types.

No, because a->b requires you to actually run some code along the lines of

a->b = new B;
or something.

It's like a linked list, which points to itself.
Whereas this is an alternating pair of types.

Ahh yes that makes sense. Not too sure why you would need to do something like this, could you post the context of your problem?

This question has already been answered. Start a new discussion instead.