← Back to context

Comment by ChrisMarshallNY

4 days ago

Back in the day, I used to do OOP with C.

It was a common pattern, back then. We’d pass around structs, and have a small library of functions that accessed/modified the data in these structs.

If you wanted, you could add function pointers to the structs. You could add “polymorphism,” by overwriting these pointers, but it was messy.

That said, inheritance can be very useful, in some cases, like improving DRY. I don’t like to take absolute stances, so much, these days.

Reminds me of cube the engine of sauberbraten2 - who uses a C/C++ hybrid with complex inheritance to inherit methods - like everything is a starts as an object. And so on and so forth.. turning inheritance into basically a mapped out set theory with the final class being the outermost part of a set holding the abilities of all inner sets. https://github.com/embeddedc/sauerbraten/tree/master/src

Its not very intuitive used that way.