// myClass.h
@interface myClass : NSObject {
int variable1;
}
- (int) addOne: (int)variable1;
//myClass.m
- (int) addOne: (int)variable1{
variable1++;
}
My question is: will [myClass addOne:aNumber] add 1 to aNumber or will it add 1 to the value of the ivar variable1?
Local variable (or function parameter) hides instance variable declaration (you should get compiler warning about that) – so local copy of aNumber will be incremented.