I think what you meant to say was "it runs counter to encapsulation...".
If you need to extract values from an object, you need a method. If you always use a method to fetch data from an object, you have no way of knowing (and no need to know) whether you are fetching an attribute or a computed value. Encapsulation means, among other things, that you have no need to know the distinction. The object makes certain data available to you via a well defined API, to wit, the methods frequently labeled "accessors".
In reply to Re^2: Accessor methods again.
by herveus
in thread Accessor methods again.
by gam3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |