阅读背景:

OOP新手:直接访问字段与传递对象作为参数

来源:互联网 

Suppose Object1 needs information from Object2. I'll say it's in an Object2 property, but the info could as easily be the return value from an Object2 function. When I look at others' code I see sometimes they will have a method in Object1 directly accessing the property. Other times I see people pass Object2 as a parameter in a method, and then access the property from the passed Object2. Suppose Object1 needs information from Object2.




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: