Re: isKindOfClass vs. loading bundles: nope?!?!?!?
Re: isKindOfClass vs. loading bundles: nope?!?!?!?
- Subject: Re: isKindOfClass vs. loading bundles: nope?!?!?!?
- From: John Hörnkvist <email@hidden>
- Date: Thu, 21 Mar 2002 17:50:09 +0100
On Thursday, March 21, 2002, at 05:11 PM, Andy Lee wrote:
At 4:07 PM +0100 3/21/02, Ondra Cada wrote:
(ii) all NSObject instance methods are by definition class methods too
Strictly speaking, no, instance methods are never class methods. What
is true is that variables of type Class respond to NSObject instance
methods by virtue of the fact that they are treated as quasi-objects.
All instance methods of a _root class_ are also class methods. That's
something you have to know, and deal with, when you're writing root
classes.
You could add it in a category.
That I did, but am still kinda bewildered that such a very basic
thing like kindOfClass: does not work?!?
You have to understand the datatype of your "class" variable and what
-isKindOfClass: does. The doc for -isKindOfClass: says:
- (BOOL)isKindOfClass:(Class)aClass
Returns YES if the receiver is an instance of aClass or an instance
of any class that inherits from aClass, NO otherwise.
A variable of type Class (with a capital C) is not an instance of *any*
class, so -isKindOfClass: is giving you the right answer.
A class object is just like any other object; it's an instance of some
meta class. That's part of the beauty of Objective-C.
Look at "struct objc_class"; the first variable is "struct objc_class
*isa".
Regards,
John Hornkvist
--
ToastedMarshmallow, the perfect Cocoa companion
http://www.toastedmarshmallow.com is relocating.
Try
http://217.215.121.176 in the meantime
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.