Hacker News new | ask | show | jobs
by rfrey 3740 days ago
Well, if everything is an object, I guess everything is an object.

Usually when people are talking about OO objects they mean data+behaviour.

2 comments

> when people are talking about OO objects they mean data+behaviour

The distinction between behavior being "a set of methods defined inside a class", and "a set of methods whose first param is a particular type of struct" is not that important.

The distinction between "a set of methods with privileged access to encapsulated internal state of a class" and "a set of functions whose first param is a particular type of struct, and operate on members of that struct that everyone can access" is pretty critical though.
Definitely, and encapsulation is one of the good things you get out of well designed OO. But I don't think it's that relevant in regards to objects as data+behavior, and while it leads to much better designs, I don't think it's required—hence all of the C libraries written in a very OO style. So: yes, but not really relevant to the point being discussed.
Object refers to a memory object, which could be data or text(functions).