title: Library design: Hiding dependencies
body: <p>I'm attempting to build a library that uses a third-party library internally, but I do not want to expose and of this third-party library to the user of my library. This way, when the static library is built, the user will only need my header and the compiled library.</p>
  
  <p>How do I deal with private members in my class definitions that are defined in the 3rd party library?</p>
  
  <p>For example . . </p>
  
  <h1>header:</h1>
  
  <pre><code>#include "ThirdPartyLib.h"
  class DummyClass
  {
      TypeFromThirdParty tftp;
  
  public:
      bool checkStuff(const float) const;
  };
  </code></pre>
  
  <h1>implementation:</h1>
  
  <pre><code>#include "ThirdPartyLib.h"
  #include "dummy.h"    
  bool DummyClass::checkStuff(const float t)
  {
      return tftp.isOk(t);
  }
  </code></pre>
  
  <p>The offending portion is the <code>#include "ThirdPartyLib.h"</code> in the header, as then the user of my library will need more than my library. </p>
  
  <p>One way of getting around this might be to forward declare all third party types used in the header and then replace the value types with references, but I'm wondering if there is another  method or design that I am completely overlooking?</p>