title: Derived classes in C - What is your favorite method?
body: <p>In my experience in object oriented C programming I have seen two ways to implement derived classes.</p>
  
  <hr>
  
  <p><strong>First Method</strong>, have a definition of the parent class as a .h file. Then each class that derives from this class will have do:</p>
  
  <p>File parent_class.h:</p>
  
  <pre><code>int member1;
  int member2;
  </code></pre>
  
  <p>File testing.c:</p>
  
  <pre><code>struct parent_class {
      #include "parent_class.h" // must be first in the struct
  }
  
  struct my_derived_class {
      #include "parent_class.h" // must be first in the struct
      int member3;
      int member4;
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Second Method</strong>, would do:</p>
  
  <p>File testing.c:</p>
  
  <pre><code>struct parent_class {
      int member3;
      int member4;
  }
  
  struct my_derived_class {
      struct parent_class; // must be first in the struct
      int member3;
      int member4;
  }
  </code></pre>
  
  <hr>
  
  <p>What is your favorite method of doing derived classes in C ( doesn't have to be what I have done )? and why?</p>
  
  <p>Which method would you prefer, first or second method ( or your own )?</p>