Objects in C

Erik on Jul 17th 2005

In this small bit of code I play around with using C structs as objects. Function pointers are stored in the struct and used as methods. The fun part of this code is that you can do inheritance by defining a child class that has all the same struct elements of the parent class declared in the same order.

inherit.c

This is probably going to be of interest to very few people. If you don’t know much about C, it won’t make any sense at all. If you are a C master, you will probably look at the code and decide I’m an idiot. But I think it’s interesting, so it’s on the site.

On a side note, if anyone can recommend a good package for doing syntax highlight using html, I’d love to hear about it.

No responses yet

Comments are closed.