title: public header class constructor
body: <p>I am new at building distributable libraries written in C++ and I am getting a bit lost.
  I have created a .cpp file with wrappers for all functions I want the library to offer users, and I have written 2 .h files, one public and one private. Below is a dummy example of my header files:</p>
  
  <h3>public.h:</h3>
  
  <pre><code>class myclass
  {
  public:
      public_function();
  private:
  }
  </code></pre>
  
  <h3>private.h:</h3>
  
  <pre><code>class myclass
  {
  public:
      public_function();
  private:
      anotherClass instanceofClass;
  }
  </code></pre>
  
  <p>Note that the implementation of <code>public_function()</code> uses the "instanceofClass" in the code.
  I have been able to compile with no problem the code using the private class and to compile and link the library with external programs using the public header and the compiled library. When executing that code, though, I am getting segmentation faults that I suspect have to do with lack of proper initialization of "instanceofClass".</p>
  
  <p>Am I doing the right thing? Am I forced to instantiate "instanceofClass" inside the implementation of <code>public_function()</code> for it to be initialized properly, or is there anything else I should do instead?</p>
  
  <p>Thanks a lot.</p>