1

Possible Duplicate:
What do the plus and minus signs mean in Objective C next to a method?

Had an error which I fixed by changing -(void) to +(void), but I would like the understand it.

Thanks.

Community
  • 1
  • 1
John
  • 1,343
  • 3
  • 15
  • 26

2 Answers2

7

This denotes an instance method. You must hold a valid instance of the class to call this method.

-(void)

This denotes a class method. You do not need an instance of the class to call this method.

+(void)
Andrew Hare
  • 333,516
  • 69
  • 632
  • 626
2

- methods are instance methods and called on a specific instance of a class.

While + methods are class methods and called on the class itself.

Meltemi
  • 37,298
  • 50
  • 191
  • 282
  • problem with answering from an iPhone...by the time you peck out & proof your answer on the stupid wide text fields...someone else has done the same... **S.O. needs an iPhone version!** – Meltemi Nov 20 '10 at 18:54