Friday, December 23, 2011

What is with - and + before methods?

When defining a class, methods are defined prefixed with "-" or "+". What is it with the signs?

- indicates the method is an instance method (per class instance)
+ indicates the method is a class method (one for all instances, equivalent to static in java/flex)

Example:
- (void) instanceMethod
+ (int) getCounter

No comments:

Post a Comment