Hi,
I have read and thought some about setters and getters lately and maybe someone can clear this out for me.
I am using the following syntax:
.h
.m
What about if I for instance would like to change the array later on in my code. I have noticed that both these following examples are actually working. Which one is correct and why? (I have been using the first one because I thought the self. makes the object retain +1...)
1)
2)
the same thing appears by getting values aswell, like:
1)
2)
MACloop
I have read and thought some about setters and getters lately and maybe someone can clear this out for me.
I am using the following syntax:
.h
Code:
NSMutableArray *list;
@property(nonatomic, retain)NSMutableArray *list;
.m
Code:
self.list = someList;
What about if I for instance would like to change the array later on in my code. I have noticed that both these following examples are actually working. Which one is correct and why? (I have been using the first one because I thought the self. makes the object retain +1...)
1)
Code:
[list removeAllObjects];
Code:
[self.list removeAllObjects];
the same thing appears by getting values aswell, like:
1)
Code:
someList = list;
Code:
somelist = self.list;
MACloop