clarification regarding properties
I'd like a little clarification, please. If I understand correctly,
there *is* a difference between using self.foo and just foo, where foo
is a property, right?
foo = whatever
just sets the value of foo to the value of whatever, but
self.foo = whatever
actually calls the method setFoo: with whatever as its argument. This
difference is important because the setter method might do some
necessary memory management which the simple unqualified assignment
Is my understanding correct?
If it is, this would be a major gotcha for Java developers new to Obj-
C. In Java, this.foo = whatever has the exact same effect as foo =
whatever when foo is a member variable of some object (except when
there's a local variable also named foo but that's a scoping issue,
not a semantic one).
Also, this means that it's best *always* to use the qualified
assignment for properties, since there's a chance that a property
might be changed from assigned to retained or copied (or from
nonatomic to "atomic").
Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to maillists@xxxxxxxxx