views:

47

answers:

1
-(id)setBigObject:(BigObject *)abc{
    self.wl = abc;
    abc.smallObject = self.smallObject; 

}

I have a abc, which is a big Object, when the user pass the bigObject, abc. I assign to my wl value, so , I write "self.wl = abc;", but I want my smallObject assign to the abc's smallObject, so, I do "abc.smallObject = self.smallObject; "

So, when I edit the smallObject in self, it will also changed in the abc's also? Am I right?

A: 

Yes, if you have multiple pointers to the same object then a change to that object through any of those pointers is modifying the same object (If I understand your question correctly).

When you assign pointers like that you should also send the object a retain message (and release it when you're done with it), unless you are using garbage collection.

Ferruccio
As these are property accesses, they are going through accessors, which *usually* means the correct memory management is being done.
Chuck
Good point. I missed that they were properties because of my C++ background.
Ferruccio
If I do the code in the order way.....for example, I change it to abc = self.wl; and self.smallObject = abc.smallObject;Is it still the same result?
Tattat