Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

deakin

classes and stuff

This topic is 6798 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

This is a really dumb question, but I can''t seem to work out what to do.... Say I have a class declared in Whatever.h and defined in Whatever.cpp how can it be accessed by other .h files? (I know it can be accessed by other .cpp files because they can include Whatever.h, but everyone says that .h files shouldnt include other .h files) Thanks in advance, - Daniel

my homepage

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by deakin

... but everyone says that .h files shouldnt include other .h files)




I don''t think that everybody says this . As long as you have the standard

#ifndef MY_HEADER
#define MY_HEADER
...
#endif

in each of your headers to prevent multiple includes you should be ok. There should be no problems with .h files including other .h files.

Another posibilty could be to group similar classes in one header file but I prefer the one class per header idea.


Andrew

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You don''t want to open up namespaces in .h-files though.
Try to use the explicit syntax in that case. (instead of "using" directive, use scope resolution).
If you don''t use namespaces, ignore me

A polar bear is a rectangular bear after a coordinate transform.

Share this post


Link to post
Share on other sites

  • 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!