3 ms·
There is a fantastic concept called encapsulation, but OO encapsulation isn't it. For an actual example of encapsulation, look at C stack variables. They are
by mrkeen 1y ago
There is a fantastic concept called encapsulation, but OO encapsulation isn't it.
For an actual example of encapsulation, look at C stack variables. They are actually encapsulated within their function.
It's how the C function is able to operate as a black box - the true meaning of "encapsulation".
If you could write getter methods to expose C stack variables to outside callers, they would become just as non-encapsulated as OO class fields.