title: Three Interconnected Objects C++
body: <p>I have three classes, class Actor, class Cell, and class Behavior. Class Actor instantiates a subclass of Behavior (defined in the Behavior header file). Behavior uses methods to analyze vectors of pointers to Actors and vectors of pointers to Cells. Cells have methods that analyze vectors of pointers to Cells, and they contain vectors of pointers to Actors. Oh yes, and in the Actor header file there is an enumerated Heading data type utilized by all classes in some way. (incorporated by declaring an extern enum Heading data type in each file that includes Actor). </p>
  
  <p>I've got most of the code, but hit a sticking point when I got an enormous list of errors related to the includes and recursive includes, and have been toiling away at it for hours. I could use some help figuring out what is the best way to arrange these objects so that they work together. </p>
  
  <p>So, to re-iterate:</p>
  
  <pre><code>Actor:    Behavior
  Behavior: vector of pointers to Cells, vector of pointers to Actors
  Cells:    vector of pinters to Cells, vector of pointers to Actors
  Heading:  Enumerated, declared extern in all classes, currently stored in Actor. 
  </code></pre>
  
  <p>Any advice as to how to go about including which header files where? I've tried many many permutations of different forward declarations, includes, etc. I honestly don't know where to go now. </p>
  
  <p>Thank you!</p>
  
  <p>Edit: Updated my class and header files. </p>
  
  <pre><code>Actor: Move, Heading
  Move:  Behavior Heading
  Behavior: Cell, Actor  Heading
  Cell: Cell, Actor  Heading
  Heading:   Used by all. 
  </code></pre>
  
  <p>As it stands, here are whats being included:</p>
  
  <pre><code>Behavior.h:  Forward declarations of Cell and Actor
  Behavior.cpp:  Includes Behavior.h, Cell.h, Actor.h
  Cell.h:   Forward Declaration of Actor
  Cell.cpp:   includes Cell.h, Heading.h, Actor.h
  Actor.h:   Includes Behavior.h, Heading.h.
  Actor.cpp:   includes actor.h
  Move.h: Includes Behavior.h, Heading.h
  Move.cpp: Includes move.h, Heading.h, Cell.h, Actor.h
  Heading: Includes nothing, declares nothing. 
  </code></pre>
  
  <p>Pretty much the only include-related error I'm seeing is the one instantiation of Move in the Actor.h file has an incomplete type. </p>
  
  <p>Edit #2: Added includes for Behavior and Move in actor.cpp and removed them from actor.h, and turned my instantiation to the creation of a pointer, and it coughed and growled at me, but it built successfully. Thanks for your help guys!</p>