Jump to content
  • Advertisement
Sign in to follow this  
ponyboy32

Class declarations

This topic is 4583 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!