I am confused about one pointer situation explained below;
In class A
@property(nonatomic,retain)NSMutableArray *words;
In class B
@property(nonatomic,retain)NSMutableArray *words;
//creating a pointer to words from classB
self.words = [classB words];
Now if I add new word to words array in Class A, why don't I see that word in words array in class B? I thought my words array in Class B is a pointer to Class A words?
Basically the changes should reflect in both arrays, until you change the reference of any of the two objects some where in your code.
//creating a pointer to words from classB
self.words = [classB words];
And some where in your Class A or Class B,
self.words = someOtherArray;
This will make the words array of both the classes to point different objects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With