开发者

Class methods and self keyword in objective-c [duplicate]

开发者 https://www.devze.com 2023-04-12 04:01 出处:网络
This question already has an answ开发者_运维技巧er here: Closed 11 years ago. Possible Duplicate:
This question already has an answ开发者_运维技巧er here: Closed 11 years ago.

Possible Duplicate:

“Invalid use of 'this' in non-member function” in objective-c context?

If I use the keyword self inside a class method:

+ (id) myMetho
{
   self ...
}

Does it refer to the class or to the current instance ?


In short, it represents the class. For a longer answer, have a look here


self just means "the class you are in"

0

精彩评论

暂无评论...
验证码 换一张
取 消