title: What were the C idioms for polymorphism and inheritance before the concepts were made explicit?
body: <p>Suppose I have the usual <code>class Animal</code> abstract class and the <code>class Dog : public Animal</code> <code>class Cat : public Animal</code> that makes it a concrete class you can instantiate an object from. Suppose further that you have a function <code>foo(Animal a)</code>, taking either cats or dogs as objects. C++ used to, in the early days, compile to C, and would build a <code>vTable</code> maintaining the objects there.</p>
  
  <p>But a student of mine asked me this question: before these concepts were usual talk among programmers, how did they <em>actually</em> do it in their day-to-day coding in C? What was (is?) the idiomatic way to program these concepts in C?</p>
  
  <p>I've sifted through the linux kernel, and other OSS projects, but I haven't been able to find a clear pattern: sometimes it's unions (for different structs), sometimes it's function pointers, etc. but I would like a straight answer from knowledgeable people in industry who've done and have a lot of experience with C.</p>
  
  <p>In one sentence: what is idiomatic C for inheritance and polymorphism? </p>