RE: Correction of 'Yet another...'
RE: Correction of 'Yet another...'
- Subject: RE: Correction of 'Yet another...'
- From: "Smith, Bradley" <email@hidden>
- Date: Thu, 6 Dec 2001 16:47:58 -0000
Because Objective C : -
a. uses colons to separate parameters (not commas)
b. (my understanding) the parameter names actually form part of the
function!
This has a number of implications: -
1. When you call a method it's clear what arguments you need to pass
2. When you call a method with many parameters it takes ages to type it!
(please no one tell me that it's bad practice to have lots of parameters to
a method)
3. No overloaded methods (I think)
4. Function names can look a bit weird (your example, for example)
The syntax is horrible at first (if you come from C or C++ or Java or
<insert language here>) but you soon get used to it.
Brad
>
Can someone explain that 'second' thing?
>
Why not that way:
>
- (int) addvalues:(int)arg1, (int) arg2 {
>
return (arg1+arg2);
>
}
>
>
sum=[self simpleMath:2,3];
>
>
Thank you!
>
Martin
>
>
P.S. Forgive me, if this is too stupid for this list.
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev