送交者: vegieTiger 于 2005-1-29, 19:43:24:
回答: JAVA里面对某些PRIVATE 变量设置SET和GET的方法有什么必要?把它们公有化不就行了么? 由 HunHunSheng 于 2005-1-29, 15:01:38:
there is an argument on how you should use getters/setters in OOP. (e.g you should not have settters/getters for all private attributes in a class, e.g. some attributes are read-only, so only getters are needed).
sometimes a getter/setter is more complex than
this.a = a or return this.a