when are you returning 中文意思是什麼
when are you returning
解釋
何日君再來-
Is called defensive copying, and despite the obvious performance cost, you should get in the habit of using it nearly all the time when returning or storing references to mutable objects or arrays, especially if you are writing a general - purpose facility that may be called by code that you haven t personally written and often even then
Getlocation和setlocation的版本3所使用的技術叫做防禦性復制( defensive copying ) ,盡管存在著明顯的性能上的代價,您也應該養成這樣的習慣,即幾乎每次返回和存儲對可變對象或數組的引用時都使用這一技術,尤其是在您編寫一個通用的可能被不是您自己編寫的代碼調用(事實上這很常見)的工具時更是如此。
分享友人