重构手法21:Change Reference to Value (将引用对象改为值对象) 你有一个引用对象,很小且不可变,而且不易管理。将它变成一个值对.
基于627个网页-相关网页
... Change Value to Reference(将实值对象改为引用对象) Change Reference to Value(将引用对象改为实值对象) Replace Array with Object(以对象取代数组) ...
基于1个网页-相关网页
Change Value to Reference 将值对象改为引用对象 ; 重新组织数据 ; 将实值对象改为引用对象
Change e Reference to Value 将引用对象改为值对象
Change e Value to Reference 将值对象改为引用对象
The convert function takes the variable containing the input string, as well as a reference to the Label widget as parameters, so that it can change the value shown by the Label.
convert以包含有输入字符串的变量以及对Label窗口小部件的引用作为参数,以改变Label所显示的值。
If you want to change an immutable object, you don't - you create a new object with the changed value and point your reference to it.
如果您想要改变一个不可变对象的话,您不会改变它,而是使用修改后的值来创建一个新的对象,并把您的引用指向它。
However, you must be aware that these alternatives change the semantics of the interaction from pass-by-value to pass-by-reference.
然而,您必须注意到这些可供选择的方案会将交互方法从按值传递(pass - by - value)改变为按引用传递(pass - by - reference)。
应用推荐