I remember ...



所有跟贴·加跟贴·新语丝读书论坛http://www.xys.org/cgi-bin/mainpage.pl

送交者: 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



所有跟贴:


加跟贴

笔名: 密码(可选项): 注册笔名请按这里

标题:

内容(可选项):

URL(可选项):
URL标题(可选项):
图像(可选项):


所有跟贴·加跟贴·新语丝读书论坛http://www.xys.org/cgi-bin/mainpage.pl