Possible Duplicate:
Method Syntax in Objective-C
I just started learning Objective-C and I’m a little confused about this statement.
+(NSMutableArray *) array;
This is what I understand:
-
+means this is a method that responds to a class (which makes this a static method) -
NSMutableArrayis an array that can have it’s size change -
*pointer ( memory location reference) -
arrayis the name of the array that is of type NSMutableArray. -
()Why does this method need parentheses around the object pointer ‘(NSMutableArray *)’
I don’t know how to conceptualize what these part mean as a whole. Can you explain this to me?
The 1,2,3 statements are correct. But fourth one is,
arrayis the name of method. The fifth one is, the return type ofarraymethod isNSMutableArray *.Finally
arrayis the class method and it hasNSMutableArray *return type and also does not any arguments.It look like
- (void)viewDidLoad.viewDidLoadis the instance method and it hasvoidreturn type and also does not any arguments.