title: Private/public header example?
body: <p>Can someone please give me an example of how public and private headers work? I have done some reading on the net but I can't seem to find much useful information with sample codes. I was advised that I should use private headers to separate the public and private parts of my code for creating a static library. After some reading I have a general idea of how it works, but would really appreciate a good example to get me started. Specifically, what I don't quite understand is how to put the interface functions in my public header, and the private variables/functions in my private header? Thanks!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Maybe I'm not wording my question right, but what I meant is, for example, I have myMath.h and myMath.cpp, and myMath.h has:</p>
  
  <pre><code>class myMath{
  public:
      void initialise(double _a, double _b);
      double add();
      double subtract();
  
  private:
      double a;
      double b;
  };
  </code></pre>
  
  <p>And myMath.cpp has the implementations of the functions. How can I make it so that myMath.h only has the three public functions, and the private variables are defined in another file (e.g. myMath_i.h), and these three files are in such a way that after I create a static library, only myMath.h is needed by users. This also means myMath.h cannot #include myMath_i.h. So something like:</p>
  
  <p>myMath.h:</p>
  
  <pre><code>class myMath{
  public:
      void initialise(double _a, double _b);
      double add();
      double subtract();
  }
  </code></pre>
  
  <p>and myMath_i.h:</p>
  
  <pre><code>class myMath{
  private:
      double a;
      double b;
  }
  </code></pre>
  
  <p>Of course that's not possible because then I'll be redefining the class myMath...</p>