|
-
December 2nd, 2010, 02:21 PM
#1
Self-referencing header files
Hello,
I have two classes, Class1 and Class2, declared in two header files, "class1.h" and "class2.h". Each class contains a member instance of the other class. If I #include the necessary header files as standard, then I get a compiler error because it creates an unlimited referencing loop. How can I solve this?
Thanks!
Code:
//"class1.h"
#include "class2.h"
class Class1
{
Class2 a_class2;
};
//"class2.h"
#include "class1.h"
class Class2
{
Class1 a_class1;
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|