开发者

Where's +alloc defined?

This may be a silly question. I need to know where is the +alloc method is defined for any Objective-C class开发者_JAVA百科? If it is a class method in NSObject how it is inherited? Because class methods cant be inherited. Thanks.


Yes, it is defined in NSObject (and NSProxy). A quick look in the documentation would have told you that.

because class methods cant be inherited.

Wrong. Where did you read that?


It's a class method of NSObject. NSObject itself does not inherit from anything because it's a root class.

alloc

Returns a new instance of the receiving class.

+ (id)alloc

Return Value
A new instance of the receiver.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜