Recently, I finished reading K&R with its, almost all, exercises and examples. I was planning to move to “Accelerated C++” that I came across Axel Schreiner’s book OOP with ANSI-C.
I am intrigued and want to learn it. But before investing time in it, I want to know the worth of implementing OOP in C. So that I can decide how much time I must spend on it.
- Implementing OOP in C, is it really used? Or its just for mental exercise?
- Are their any existing C projects that use OOP?
- When it is a good idea to use OOP in C?
- Should I invest my time in it?
I think its appropriate that I mention my background here so that you guys can guide me in a better way. I finished C, C++, Java and OOP theory about a year ago, have got a job too. But then Joel’s blog and SO made me realize that I lack in a lot many things. So I picked up the books again and start studying them properly.
K&R, Accelerated C++, Algorithm in C++ and some other books are my attempt to to improve my skills. I am not new to OOP.
So what would you suggest?
Thanks for your time.
OO is used in C as often as needed. Generally I don’t agree with the opinion that one cannot do OOP in C, as soon as you provide set of functions that operate on a given type you have OOP. Take for example, you decide to create a data structure. If you provide functions to create, add, remove, and find elements of the data structure it’s OO. Generally other languages provide syntactical sugar by automatically implying an instance variable and scoping in various properties of that instance automatically.