Instance method implementations

First off let me say thanks for a fantastic book! Very informative and I’m learning a lot but I’m hung up on one thing I can’t understand. Take the following code:

-(void)addAsset:(BNRAsset *)a; { //Is assets nil? if(!_assets){ //create the array _assets = [[NSMutableArray alloc]init]; } [_assets addObject:a]; a.holder = self; }

I understand that this is a instance method that BNRAsset objects use to place objects into an array. I don’t understand the first line though. Does that line mean that addAsset is being called on a pointer to a BNRAsset object? Why is the “a” outside the ()?

Thanks for the help!

This is saying you can pass an instance of type BNRAsset. The ‘a’ is the local pointer/variable that represents the object you are passing into the method. So in the exercise it has this in main.m

// Assign the asset to the employee [randomEmployee addAsset:asset]

So when you pass :asset in when it reaches the method implementation the ‘a’ represents that object in the method. It’s basically like a local variable. But it is also a pointer.