Can Objects Be Friends?

As discussed before, proper encapsulation leads to a complete absence of "naked data." However, the question remains: How can objects interact if they can't exchange data? Eventually we have to expose some data in order to let other objects use it, right? Yes, that's true. However, I guess I have a solution that keeps encapsulation in place while allowing objects to interact.

Raging Bull (1980) by Martin ScorseseRaging Bull (1980) by Martin Scorsese

Say that this is our object:

class Temperature { private int...
 •  0 comments  •  flag
Share on Twitter
Published on December 19, 2016 16:00
No comments have been added yet.