Possible Duplicates:
Objective-C: Class vs Instance Methods?
What do the plus and minus signs mean in Objective C next to a method?
I've tried to look around and couldn't come up with a solid answer that really explained my confusion. I've seen a few times and that is a class having a method that has it's "method type" set to "+" ie:-(Fraction*) fractionWithNumerator: (int) n denominator: (int) d;
now how is that different to +(Fraction*) fractionWithNumerator: (int) n denominator: (int) d;
"+" is a method called on the class. "-" is a method called on an instance.
+alloc: because you would say [NSString alloc]
-init: because you would call init on an instance rather than saying [NSString init]
The difference is one is a class method(+) and the other is an instance method(-). Details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With