logoalt Hacker News

usrnmtoday at 7:23 AM1 replyview on HN

Your example lacks data. An object is the combination of data and code manipulating the data with some syntactic sugar on top


Replies

Mikhail_Edoshintoday at 9:09 AM

Data will indeed be necessary. But data in OOP are interesting: they are not supposed to be directly visible. They are like the method body: there is one, but it is not important what it is. So if we add data, it will be that:

    class Aaaa
      (some data)
      method bbbb():
        (some code)
Do you think this is an object now?
show 1 reply