in reply to Accessor methods again.
Hi,
As always, it depends. If you use different accessor methodes for each attribute you can easility mimic public,private, and protected access. See Re: OO - best way to have protected methods for more. If you don't need, don't use (kiss ;))
Different setter methods have an advantage: you can put code in it to check the parameters. As the setting for the attribute in question only occurs in one place your code becomes simpler to update.
A single getter/setter shared by all attributes can do the same but becomes complex the moment you have many attributes, plus, you loose the public, private, protected simplicity.
|
|---|