News for hackers. Stuff that matters.
Re:Inheritance versus Composition by BurningFrog on Thursday May 09, 2019 @02:34AM (#19865904)
The Point could internally be represented in a polar coordinate system.

I kind of agree that encapsulation isn't needed for object status. The caveat only being that it would be a weird object system where you could be sure there was no encapsulation.

I mean, OK, in some languages you know that. But does it change anything important?

https://en.wikipedia.org/wiki/Polar_coordinate_system

Re:Inheritance versus Composition by kazinator on Thursday May 09, 2019 @02:03PM (#19870579)
Even if a point uses polar coordinates internally, we can have syntax "p.x" which gets the Cartesian x.

Information hiding is an important concept in low-level-ish systems programming languages in which p.x implies a piece of machine code that offsets 24 bytes from the base address of p, and fetches a four byte integer.