更新时间:2023-10-26 19:16:04
自我
是必要的你希望一个对象发送消息,好吧, self
。通过getter / setter访问属性有时也是有益的,在这种情况下,您还需要使用 self
,如 self.propertyname
或 self.propertyname = value
。 (这些不等于 propertyname
或 propertyname = value
。
self
is necessary if you wish for an object to send messages to, well, itself
. It is also occasionally beneficial to access properties through getters/setters, in which case you'll also need to use self
, as in self.propertyname
or self.propertyname = value
. (These are not equivalent to propertyname
or propertyname = value
.