   (C/C++) Inheritance/public problems
  Hello everyone!I've been dangling between Windows' Visual Studio 2010 and Mac OS X' Xcode trying to get this to work. At first I thought it was Xcode (since I mainly develop on Mac OS X,) but as I've seen Visual Studio react the same I'm certain it's my code..even though I followed a couple of guides on inheritance very well.These are the errors I'm getting:http://i46.tinypic.com/30c22kp.pngGlobal.hhttp://pastie.org/private/ekqfkldbpmrqch7hxtsdxgItemDatabase.hhttp://pastie.org/private/haitralizords0eryuaPlayerNPCS.hhttp://pastie.org/private/8a0grvqrd9pgx7r5qqcaThe main.cpp simply contains an int main() including the globals.hNow, I have been doing web development for the past 2 years (needed to get a development machine together,) so I'm rusty on C/C++. I thought I'd greatly refresh my memory and start working towards fulltime game development again as I finally find myself have more free time.In any case, sorry to drift off.Does anyone perhaps see what I'm doing wrong?To learn about inheritance I read and followed several articles including the first place I usually check, cplusplus.com; http://www.cplusplus.com/doc/tutorial/inheritance/But obviously I'm probably doing something wrong lol..Any help is appreciated, thanks all! :)~JEdit:P.S. I hope I included enough information..if not, please let me know and I'll include anything else that's needed. :)   
  You have PlayerNPCs trying to inherit from ItemDatabase and ItemDatabase inheriting from PlayerNPCs. How do you expect that to work?   ;  Well, I only recently started looking into inheritance as I understood they came in very handy. I didn't see that part, nor knew that wouldn't work, my bad.I removed the inheritances:PlayerNPCS.h: http://pastie.org/private/cnt7qlmrkzpweesffkvdmwItemDatabase.h: http://pastie.org/private/aik4hatqq6yy1o0fdsra2 errors: http://i49.tinypic.com/vy2rkz.pngIt still says that the clas(ses) are undefined, I'm really missing something big here huh?Basically anything in the files now is nothing I haven't done before and had working (except for the inheritance part which was something new I was trying out.)Sorry if it's quite a stupid thing I'm missing, I don't consider myself out of beginner-stage just yet.Thanks for the help so far!~j   ;  hey auriya.The errors that you have are cause you need to include class headers in order to use objects of this class.You just need to add this below #include "globals.h":#include "playernpcs.h" (in ItemDatabase.h)#include "ItemDatabase.h" (in PlayerNPCs.h)   ;Quote:Original post by Juanxohey auriya.The errors that you have are cause you need to include class headers in order to use objects of this class.You just need to add this below #include "globals.h":#include "playernpcs.h" (in ItemDatabase.h)#include "ItemDatabase.h" (in PlayerNPCs.h)Hey!I have included both header files into globals.h, which are included into both header classes.Globals.h: http://pastie.org/private/ekqfkldbpmrqch7hxtsdxgCould that be the cause? (Multiple inclusions? I heard about it but I was told #ifndef, #define and #endif takes care of that..)~J   ;  Your problem now isn't multiple inclusion, it's circular inclusion. Read  this and pay attention to problem 2.   ;Quote:Original post by AuriyaI have included both header files into globals.hThis is screaming "anti-pattern". What are you trying to achieve with your globals.h?   ;Quote:Original post by SiCraneYour problem now isn't multiple inclusion, it's circular inclusion. Read  this and pay attention to problem 2.Thank you, that link helped me lots!A friend of mine already slammed some logic into me with "Idiot, your mom can't inherit from you as you have inherited from her. Your problem right there."Quote:Original post by DevFredThis is screaming "anti-pattern". What are you trying to achieve with your globals.h?In previous games I included all my .h files into globals and included into main (and other files that needed certain files,) should I find myself lucky my games didn't create a black hole or something? If this is a bad idea I'll have to [really] go back and change the code in those games!( Edit: Sorry for the late reply, ISP found it funny to break irrelevant things during maintenance. )   