title: Multiple inclusion of header file c++
body: <p>I have a problem  regarding multiple inclusion of header file in C++ code.</p>
  
  <p>Say for example, I have three classes X, Y, Z. X and Y are derived from base class Z. And I want to create an instance of X in Y. The code will go like this.</p>
  
  <pre><code>class Z { …some code… };
  
  class X: public Z { …some code… };  //here #include header of class Z added
  
  class Y: public Z  //here #include header of class Z added as well as of X class
  {
  private:
     X* mX;    //instance of X 
  
     …some code…
  };
  </code></pre>
  
  <p>So in this multiple definition of all methods of base class arises. How can I cope with this problem?</p>