On Thu, Jul 2, 2009 at 3:48 AM, Bill Cheeseman<b...@cheeseman.name> wrote: > I did find it confusing when I read the NSMenuItem and NSToolbarItem Class > Reference documents, which say that they conform to the other protocol, the > NSValidatedUserInterface protocol. But this tends to suggest that NSButton > will work, too, since NSControl, from which NSButton inherits, also conforms > to the NSValidatedUserInterface protocol. It doesn't say so, but Apple's > documentation has a long history of neglecting to mention all the protocols > that a class conforms to. I was able to confirm from the NSControl Class > Reference document, and you can too, that NSControl does implement the > -action and -tag methods required by the NSValidatedUserInterface protocol. > So, again, I don't understand why you say it doesn't.
Because it doesn't. You seem to think that protocol conformance is simply a matter of having declared the proper methods. That's not how it works. If you check with -conformsToProtocol:, it will return NO. If you try to assign to a pointer of type id <NSValidatedUserInterface> the compiler will warn you. Protocol conformance is a matter of having the declaration in the header. Nothing else counts. Especially here, where the protocol is obviously being used as a way to claim a particular behavior, not just an ability to respond to certain selectors. As proof, I submit NSObject and NSCopying. NSCopying contains a single method, -copyWithZone:. NSObject implements this method. And yet, NSObject does not conform to NSCopying, and if you try to copy one it will fail. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com