title: How do you implement a class in C?
body: <p>Assuming I have to use C (no C++ or object oriented compilers) and I don't have dynamic memory allocation, what are some techniques I can use to implement a class, or a good approximation of a class? Is it always a good idea to isolate the "class" to a separate file? Assume that we can preallocate the memory by assuming a fixed number of instances, or even defining the reference to each object as a constant before compile time. Feel free to make assumptions about which OOP concept I will need to implement (it will vary) and suggest the best method for each.</p>
  
  <p>Restrictions:</p>
  
  <ul>
  <li>I have to use C and not an OOP
  because I'm writing code for an
  embedded system, and the compiler and
  preexisting code base is in C. </li>
  <li>There is no dynamic memory allocation
  because we don't have enough memory
  to reasonably assume we won't run out
  if we start dynamically allocating
  it.</li>
  <li>The compilers we work with have no problems with function pointers</li>
  </ul>