Difference between + and - methods in Objective-c

后端 未结 5 1758
野的像风
野的像风 2020-12-14 06:42

What is the difference between methods that are declared with - and methods that are declared with +

e.g

- (void)methodname

+ (void)methodname
         


        
5条回答
  •  北海茫月
    2020-12-14 07:03

    minus are instance methods (only accessible via an instantiated object)

    plus are class methods (like in Java Math.abs(), you can use it without an instantited object)

提交回复
热议问题