On Oct 21, 2009, at 9:43 AM, Jim Kang wrote:

That selector is a unique index that points to a method of a specific class.

No, that's not true of Objective-C (although it is of C++ method- pointers.) A selector is, basically, just a unique string: it defines a message, not a method, to use the old Smalltalk OOP terminology. Any class that implements a method with that name uses the same selector for it, regardless of inheritance.

To be specific, if I create two unrelated classes A and B, each of which implements a -foo method, the selector @selector(foo) is used for both.

Joshua's problem was, apparently, that he was trying to send an message to a class object instead of an instance, but the corresponding method was defined on instances, not the class.

—Jens_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to