3 ms·
I have read Object oriented programming with ANSI-C and implemented my own class system in C with inheritance and polymorphism. Taking a look at Writing Bug-fr
by deletes 13y ago
I have read Object oriented programming with ANSI-C and implemented my own class system in C with inheritance and polymorphism.
Taking a look at Writing Bug-free C Code the chapter about class is really just an example how to use structs with pointers that don't expose the underlying implementation.
If you want to learn oop read the Oop with Ansi-C, where classes similar to c++ with certain limitations are possible. The book explains everything in detail with including source code[http://www.cs.rit.edu/~ats/books/ooc-14.01.03.tar.gz http://www.cs.rit.edu/~ats/books/ooc-14.01.03.tar.gz].
- ExpiredLink 13y agoThis seems to be the horrible Schreiner book. IIRC, he tries to do OO in C by using a special pre-processor. Sorry, this approach has never been relevant.
- deletes 13y agoYes a single chapter is dedicated to that, all the code is beforehand explained and then implemented in the preprocessor. Everything can be implemented by hand. The point of the books seems to be mostly educational, if you would decide to actually use oop in serious projects then writing your own preprocessor would solve two problems. The tedious manual table/pointer writing and avoiding mistakes coming from the former. I would love to get some book recommendation regarding the subject from you.
- Roboprog 13y agoSarcasm? The original "C with Classes" was a preprocessor, I believe.