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,413
  • 3
  • 16
  • 27

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
  • 344,730
  • 71
  • 640
  • 635
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,979
  • 50
  • 195
  • 293
  • 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