Object ownership


#1

When each of the 10 asset arrays are created, there are a few lines of code… and then the asset gains an owner, when it’s added to the randomEmployee. But what happens in the few lines between being created and being added to the employee? Who owns it?

I’m guessing ARC is covering up stuff we might have seen in the past - would there traditionally have been a release statement at the end of the for loop, after the asset is given an owner?

(I’m probably thinking way too much about this stuff, at this stage, but I’ve really enjoyed this chapter - it’s made stuff sink in that hasn’t in the past - but this is playing on my mind a little so if someone can clear it up, I’d really appreciate it!)


#2

Actually, it is owned by the frame.

That is: the local variable asset is a strong reference:

Asset *asset = [[Asset alloc] init];