Mail Archives: djgpp/2000/04/11/17:05:39
| From: | Bram de Greve <bram DOT degreve AT rug DOT ac DOT be> | 
| Newsgroups: | comp.os.msdos.djgpp | 
| Subject: | classes? | 
| Date: | Tue, 11 Apr 2000 21:38:13 -0700 | 
| Organization: | University of Ghent, Belgium | 
| Lines: | 39 | 
| Message-ID: | <38F3FDB4.DCDEBD61@rug.ac.be> | 
| NNTP-Posting-Host: | sdlna121.rug.ac.be | 
| Mime-Version: | 1.0 | 
| X-Mailer: | Mozilla 4.04 [en] (Win16; I) | 
| To: | djgpp AT delorie DOT com | 
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp | 
| Reply-To: | djgpp AT delorie DOT com | 
If have this strange problem, can anyone help me please ???
Say, I have two classes Class1 and Class2.
I have the the stuff (interface and implementation) of Class1 in
class1.hpp and class1.cpp.
The stuff of Class2 is in class2.hpp and class2.cpp.
Both classX.hpp are done with
   #ifndef __CLASSX_HPP_
   #define __CLASSX_HPP_
   ...
   #endif
so I can't include twice the same file.
So far, so good,  I can compile both class1.cpp and class2.cpp.
Now, in Class1, I need a member object of Class2
   class Class1
   {
      Class2 * myClass2;
      ...
   };
Thus in class1.hpp, I include "class2.hpp" so that Class1 "knows"
Class2.
I also need a member object of Class1 in Class2
   class Class2
   {
       Class1 * myClass1;
       ...
   };
Thus in class2.hpp, I include "class1.hpp".
MY PROBLEM IS: THIS NEW SITUATION WILL NOT COMPILE!!!
WHY???
Thanks in advance,
Bramz
- Raw text -