What does “o” mean in an instance method argument?

New in objective-c,

-(void) myfunction : (int) d 

This means that it returns 'void' and accepts a single parameter of type int.

What does the following mean?

-(void) myfunction:o
+3
source share
2 answers

it means

- (void) myfunction:(id) o

For example, the method

-(void) myfunction:o:p:q {
    NSLog(@"%@, %@, %@", o,p,q);
}

When called with

[self myfunction:@"test" :[NSNumber numberWithInt:4] :nil];

Prints out:

2012-04-14 08:02:20.470 Test[36499:f803] test, 4, (null)
+3
source

Both are the same

In objective-c, the name of the first parameter is treated as the name of the function

-1
source

All Articles