classes in classes

Started by
3 comments, last by Damocles 21 years, 9 months ago
Another little class question.... ...I want to try and use classes as much as possible for the game I''m working on, so basically anything that can be a class will be. However, I''m finding one problem: say I have: class TypeA { int whatever; float something; TypeB *ObjectB; } TypeB is a clas define in another header file. I know I can just include that header file and all is well, but if I use that method, by the time I get half-way through making the classes, I''ll have pages of include statements in each header file, and that''s just not good. So what''s the best way of making class objects inside other classes?
------------------------------------------[New Delta Games] | [Sliders]
Advertisement
Forward declaration.

[twitter]warrenm[/twitter]

You can also use:
class TypeB *ObjectB; 


/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/
...which is an inline forward declaration.

[twitter]warrenm[/twitter]

I had a feeling it was some kind of forward declaration, but I wasn''t sure.

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/
/*=========================================// Chem0sh// Lead Software Engineer & Tech Support// http://www.eFaces.biz=========================================*/

This topic is closed to new replies.

Advertisement