I'm using a sort of "class hierarchy" in the game, though. For instance, different types of enemies behave and are drawn in different ways, but share common traits, so "virtual functions" become useful there. In those situations, I'm using run-of-the-mill "object-oriented C":
typedef union foe foe;
/* the "abstract superclass" */
struct foe_common {
vector2 position;
void (*update)(foe *);
void (*draw)(const foe *);
/* ... */
};
/* a "concrete subclass" */
struct foe_sitting_duck {
struct foe_common common;
vector2 direction;
/* ... */
};
union foe {
struct foe_common common;
struct foe_sitting_duck sitting_duck;
struct foe_ninja ninja;
/* ... and so on */
};
