I'm learning objective-c (via apple) and just finished up the portion that explains method syntax.
I decided to write a very simple method in a 'helper' class that would add two numbers...
the interface...
+ (int)addTwo:(int)num1 secondNum:(int)num2; implementation...
+ (int)addTwo:(int)num1 secondNum:(int)num2 { return num1+num2; } usage...
int test = [MyClass addTwo:1 secondNum:2]; Now my problem is this..
everything compiles and is syntactically correct, however, in my opinion the usage of the method is extremely awkward, and in my opinion should be something along the likes of...
int test2 = [MyClass addTwo: firstNum:(1) secondNum:(2)]
basically, something that is more verbose in explaining that 1 is the first number and 2 is the 2nd.
As I write this I see that I could write something like "addTo:1, thisNumber:2" which is more clear, but I'm afraid I'm missing something important, or I didnt pick up on something that the lessons were trying to teach.
I'm used to Java so a lot of this is new in some ways, and If this is how objective c code is written, thats perfectly fine, but I just wanted to make sure I wasn't missing anything.
Thanks in advance.
+addNumber:toOther:.