Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8811295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:19:41+00:00 2026-06-14T03:19:41+00:00

I have three classes, class Actor, class Cell, and class Behavior. Class Actor instantiates

  • 0

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).

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.

So, to re-iterate:

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. 

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.

Thank you!

Edit: Updated my class and header files.

Actor: Move, Heading
Move:  Behavior Heading
Behavior: Cell, Actor  Heading
Cell: Cell, Actor  Heading
Heading:   Used by all. 

As it stands, here are whats being included:

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. 

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.

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:19:43+00:00Added an answer on June 14, 2026 at 3:19 am

    As long as the only dependency is a pointer, just use a forward decl. With that rule only include is for actor.h to include behavior.h and heading.h

    behavior.h -> declare Cells and Actors
    Cells.h -> declare actors

    Behavior and cells cpp will have to include the header files of the forward declared classes.

    behavior.cpp -> include Cells.h and Actors.h
    Cells.cpp -> include actors.h

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three classes: A data holder class CDataHolder, which uses a Pimpl pattern
I have defined three classes: class Animal < ActiveRecord::Base end class Cat < Animal
I have three classes mapped using the table-per-subclass class mapping strategy. The tables are:
If I have three classes class A class B extends A class C extends
In a rails 3 app I'm building I have these three classes: class Instrument
I have three classes; Classes A and B both reference class C . How
I have three model classes that look as below: class Model(models.Model): model = models.CharField(max_length=20,
I have a class (ActorClue) that has three attr_accessor defined within it. There are
I have three classes like this. class A { public class innerB { //Do
I have three classes; their function definitions are in a sperate file. I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.