3 ms·
Your example lacks data. An object is the combination of data and code manipulating the data with some syntactic sugar on top
by usrnm 3mo ago
Your example lacks data. An object is the combination of data and code manipulating the data with some syntactic sugar on top
- Mikhail_Edoshin 3mo agoData 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?
- usrnm 3mo agoYes, it is an object now, at least in my book. Public/private is less important, there are examples of OOP systems with private data being optional or non-existent at all, for example in Python.