   Multiple inheritance & header/source files
  I''ve been programming in c++ for several years now, but since I''ve started delving into class inheritance, I''ve had some trouble with including header files more than once.  I''ve gotten used to starting headers with #ifndef SOMEFILE_H #define SOMEFILE_H and ending them with #endif.  The game engine I''m building has separate source/header files for each module.  There''s the CDisplay class, the CRenderer class, the CSettings class, the CConsole class, and the CDebug class.  So far, everything is derived from CDebug, which has a Write() function.  CDisplay, CRenderer, CSettings, and CConsole each have corresponding variables defined as extern in the header and simply defined in the source, like this:(display.h)class CDisplay{ ... };extern CDisplay Display;(display.cpp)#include "display.h"CDisplay Display;And so on with each of those classes.  I only need one instance of each of those classes, though.  I want to make sure I''m doing this "right", or at least in a way that is good coding practice.  Should I be using static variables or classes somehow?  And what should be defined in the header and source files; the actual instance of the class?  Thanks in advance for any ideas or suggestions on this one.  And if anyone has a good link to a page on detailed multiple inheritance with files, please let me know.  Thanks.   [JESUS SAVES] 
  You may want to look into creating the objects as singletons.  Some people don''t like them, but you can''t please everyone. -Odd the Hermit ;  I'll give you my point of view.OO programming is about making relations. You can start with a class with the name of your game, Tetris for instance.This CTetris has other classes like input, sound and so on.Your approach is that a CDisplay isa CDebug which I think is wrong. Actually, a debug file (or class if you prefer) is the only thing you should have global. Simply do this for the debuging:// debug.h#include <fstream>extern std::ofstream ofLog;// debug.cppstd::ofstream ofLog;   Then in the init() method of CTetris, you open up the log, then init CDisplay, CInput. In those .h files you just put #include "debug.h" and you will have the same debug file to play around with.But hey! Keep experimenting with OO relations!EDIT: so your tetris.h could look like this:class CTetris{public:    HRESULT init()    // etc...private:    CTimer   _Timer;    CDisplay _Display;    // etc...};[edited by - Enselic on August 19, 2003 5:19:21 PM]