Seems more like a sentence fragment than a statement.
–
RigApr 7 '13 at 0:40

1

You would find the origins of C++ and objective c to be interesting - stating out as c preprocessor macros and a bit of a runtime libraries.
–
MichaelTApr 7 '13 at 7:19

Its a lot like using a hammer to drive in a screw. Much better, faster, easier and safer to go to your toolbox and get a screwdriver. Its considered unprofessional for a builder to hammer in screw, yet it's called other things when a programmer does it!
–
mattnzApr 7 '13 at 23:07

2 Answers
2

Yes. Early C++ compilers translated the code to C before compiling with a normal C compiler. Today, that's how Vala works. Vala is based on the GLib Object System, which provides object-oriented features for C, but is apparently quite cumbersome. Vala streamlines the process.

This is exactly right. If you dive into the internals of something like Ruby or PHP now, you'll find that those object oriented languages are implemented the same way: structs passed around as the first argument to functions (methods). Objective-C still works this way internally.
–
d11wtqApr 7 '13 at 2:17

Thanks. I modeled it on basic GLib behavior. If I'm not mistaken, many of C++'s inheritance pathologies go back to how this is done in C, no? (Well, that and the decision to allow multiple inheritance.)
–
James JensenApr 7 '13 at 2:32

There's a rough way to do it in any language using something like a struct. You just need to make sure to have some variables local to that struct and a set of functions (methods) that operate on them. You'd store functions via pointers to those functions and only accessing things via a given struct. There's an extensive book written on doing such programming in ANSI-C as referenced in this Stack Overflow post.

Python's objects are dictionaries of variables and functions in a similar vein. Other languages also use this approach and languages that support dictionaries can be made to work similarly. Even languages that don't could be made to if you figure out how to make a dictionary in them.