Monthly Archives: September 2016

A Solution For Polymorphism in C

When crafting software in C language for embedded systems, sometimes you need more than the language can offer. Its closeness to the hardware means that, sometimes, it’s a bit far from what a high level language can offer.

The implementation of polimorphism is, from my point of view, one of those things that requires emulation through tricky constructs, always with drawbacks.

After much time looking for a solution to this problem, I came up with one that, I think, is the closest you can get to object oriented programming. This solution features:

  • One depth class hierarchy.
  • Static declaration of any object from the class hierarchy.

Continue reading