4 ms·
How does C's version compare to the approach in C++ of using composition (instead of inheritance) to combine several objects into one? I guess C allows finer-
by lurker19 15y ago
How does C's version compare to the approach in C++ of using composition (instead of inheritance) to combine several objects into one?
I guess C allows finer-grained "monkey patching" of one function pointer?
- zwieback 15y agoYes, I think the main difference is that run-time changes are allowed. C++ composition and things like mixins using templates allow combining without inheriting but everything is statically typed at compile time. Of course all this dynamic stuff and more is still possible in C++, in fact, C++ features could be used to build a better "dynamic patching" mechanism than C, so it's not really an argument against using C++ at all, I'm a big fan myself. The interesting question remains whether C code, no matter what kind of feature is implemented, is inherently easier to maintain for a project like the Linux kernel.