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.
精彩评论