in reply to Re^4: Prevent direct acces to object's attributes
in thread Prevent direct acces to object's attributes

I note that for the simple example there, the methods and variables are completely independent of each other.

What happens when the child needs to affect the parent's values? I suspect it would be difficult to keep the Traditional child pure in a practical situation, and you'd end up with an inflexible hybrid child, or a significant re-implementation of the parent to handle the Traditional hijinks that ensue when get/set methods are skipped.

  • Comment on Re^5: Prevent direct acces to object's attributes

Replies are listed 'Best First'.
Re^6: Prevent direct acces to object's attributes
by JavaFan (Canon) on Sep 08, 2009 at 16:12 UTC
    What happens when the child needs to affect the parent's values?
    Then the child uses the API the parent provides, typically in the form of accessors.

    Or do you mean "the child cannot access the attributes of the parent directly?" Well, of course it cannot. That's what the OP wanted, and what Inside-Out objects can provide. (Note that Inside-Out objects can allow for direct access by using 'our' instead of 'my' for the attribute hashes).