There are three different syntax styles for accessing properties of an object:
myProp = value;
self.myProp = value;
[self setMyProp: value];
Are these purely style choices or is there difference in substance?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
and
are style choices, as they are using accessors to set values. That is,
self.myPropessentially is the same as calling[self setMyProp]or[self myProp]. It will implement whatever mechanism you define in the@propertytag (retaining, releasing as needed, etc).However,
is substantially different as it is simply an assignment. No consideration for releasing
myProp‘s original pointer, retaining the new value, etc.