in reply to Re: Accessor methods again.
in thread Accessor methods again.
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".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Accessor methods again.
by gam3 (Curate) on Oct 07, 2005 at 05:40 UTC |