Quote:
Originally Posted by algernong
The ISO definitions seems to be irrelevant since it only defines what a language needs to be called "OOP language"; I didn't claim C to be an OOP language by definition but that you can write object oriented code with it (i.e. code that is in line with the paradigm) and that it is practical to do so.
The second quote seems to be a definition of the paradigm, right? So it's about code itself, not the language and doesn't contract my stance as far as I see it. Your code example seems to be in line with this definition.
|
Well the points 4 and 5:
Quote:
4. Every object is an instance of a class (which must be an object)
5. The class holds the shared behavior for its instances (in the form of objects in a program list)
|
First of all, there is nothing in C that can nearly count as a class, which is a object itself to interact, and secondly there is no code bound to the class (as there is no class). The functions for structs are just simple functions, can be called from wherever, with whatever parameters.
So this is basically completely missing, and this is the most important part of OOP.
My main problem with calling this OOP is, that this would make the term procedural programming redundant, as with this, strict procedural programming (which also requires the encapsulation of state based code into procedures, while the state is a dataset) would cover exactly the same within C. Therefore im finding it pretty hard to say, lets say we also have classes in C (except for there is no real definition what this might look like) and call it OOP.
Or to put it in another light, if you are using C++, and mix this style with real OOP, how do you discriminate, because compared to C++ classes calling both OOP is not really helpful