4 ms·
Just out of curiosity, what is the typical OOP definition of object?
by oriolid 4y ago
Just out of curiosity, what is the typical OOP definition of object?
- gpderetta 4y agoAh, that's a trick question. There is no typical OOP definition of object. I used to think that only aspect everybody agrees on is late binding, but some people consider traits-like static binding a form of OOP.
- oriolid 4y agoWell, you brought up the subject :) I think it's a bit intellectually dishonest to appeal to typical OOP definition when there isn't one (except that your language isn't true OOP but my language, I won't tell which one, is). And there are quite a few different definitions of late binding too.
- deleted 4y ago[deleted]
- gpderetta 4y agoThere are multiple contradicting definitions of OOP, but I don't know any that would include C POD types and primitives.
- oriolid 4y agoThe original claim was that C++ "objects" and C PODs and primitives are the same. It's a rather odd claim, and the questions whether C++ "objects" are true objects, there is even a definition of true object, or was object oriented programming a good idea to begin with, don't seem to be closely related.
- gpderetta 4y agoThe standard definition definition of Object in C++ is the same as the definition of Object in C because the standard says so: https://en.cppreference.com/w/cpp/language/object https://en.cppreference.com/w/cpp/language/object . Is not a problem of interpretation. It is just that the C standard uses the term object for just a bunch of memory (with a type) and the C++ standard does so too. Nothing to do with objects in the OOP sense.
- oriolid 4y agoThis is interesting. The page you linked mentions that objects can be created using operator new, but I was not aware that C has such thing. Further down polymorphic objects are introduced, and I am fairly sure C does not have those. My favorite detail is mention of "implicitly defined copy/move special member functions", but it is never explained what member functions are. Almost as if you were using a definition that is missing something to prove some kind of point. By the way, the document you linked to is not the standard. The published standards are not freely available, but here is the relevant part of current draft: https://eel.is/c++draft/intro.object https://eel.is/c++draft/intro.object