4 ms·
Stupid question: what do you do when you're working in C and want OOP?
by starpilot 16y ago
Stupid question: what do you do when you're working in C and want OOP?
- burgerbrain 16y agoUse OOP. :) But seriously, you don't need a language to smack you in the face with OOP syntax to use OOP, and with anything in programming, if you try to do it just like you do in other languages, you're going to be disappointed.
- jpr 16y agoDepends on what you mean by OOP. But function pointers (mostly in structs) are one way to do it.
- bergie 16y agoWe use GObjects for that: http://library.gnome.org/devel/gobject/stable/ http://library.gnome.org/devel/gobject/stable/ Through GObject Introspection this also means we get automatic OOP bindings to a bunch of higher-level languages
- derleth 16y agohttp://www.bolthole.com/OO-C-programming.html http://www.bolthole.com/OO-C-programming.html That's a simple intro to doing OO in C, mainly by becoming a human compiler that goes from whatever OO language you really want to C. Note well that OO isn't a well-defined concept. Look at this list of features and ask yourself which of them you think of as being OO: http://www.paulgraham.com/reesoo.html http://www.paulgraham.com/reesoo.html
- eru 16y agoWhy would you want that?