• Advertisement
Sign in to follow this  

Class declarations

This topic is 4501 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a question on class declarations. How do you allow two classes to have objects of each other? For example, I'm have a two classes in a header file, BaseState class and StateManager class. The BaseState class is declared first in the file and accepts a StateManager object in one or more function parameters. My compiler complains that is it doesn't know about the StateManager object yet because it hasn't gotten to the StateManager declaration. I can't move the StateManager declaration because one or more of it's functions accept a BaseState object. How do you make this work aside from putting the declarations in seperate header files, I would like to keep them in the same? Is this possible? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement