NSUInteger randomIndex = random() % [employees count]; Employee *randomEmployee = [employees objectAtIndex:randomIndex]; [randomEmployee addAssetsObjects:asset];
Except for the lines above, I think I have the code for the rest of this chapter figured out.
So this is what I understand so far:
randomIndex is an object of NSUInteger that gets assigned a random number from 0 - 9 from employees array.
*randomEmployee is a pointer to an object in the employees array that is assigned assigned by randomIndex. Why does it need to be an object pointer of Employee?
addAssetsObject method in randomEmployee is called and passed the parameter of asset (which is an object of Asset class). Why do we need to pass “asset” as a parameter?
Doesn’t addObjects only accept a pointer to an object of Asset?
I’m not sure what’s going on with these lines, especially the second and third line of code. Please advise.