开发者

Where's +alloc defined?

开发者 https://www.devze.com 2023-01-20 23:33 出处:网络
This may be a silly question. I need to know where is the +alloc method is defined for any Objective-C class开发者_JAVA百科?

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

精彩评论

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