Author | Message |
---|---|
jroble52
Posts: 15
|
Posted 00:24 Feb 16, 2018 |
So I'm just wondering; if a class has many instance variables, is it better to use one setter, or several setters? Like in an Address class with a bunch of instance variables is it better to just have a setAddress method instead of having a setVariable for each variable? Sorry if the question sounds vague but if you want me to elaborate on what I'm asking I'll be glad to do so |
jhurley
Posts: 207
|
Posted 07:23 Feb 16, 2018 |
Usually a setter sets the value for one field. It's easy to think of situations in which you would want a method that takes arguments and uses them to set values for more than one field. There isn't any particular name for a method like that. |