Mike et al,

OK, I get it -- @optional in a @protocol is kind of like #pragma warning:XXXX 
in (MS) C++ in that it just tells the compiler to not generate specific 
warnings, in this case warnings about a class that doesn't fully implement the 
protocol. I thought it would automatically call -respondsToSelector, but I 
understand that that's runtime behavior, and the protocol doesn't alter what 
the object does in the runtime. Thanks, all!

Regards,

John, who loves it when he learns something and can verify it himself) :-)

On Jan 5, 2010, at 11:06 AM, Mike Abdullah wrote:

> Protocols cannot decide or change behaviour of an object. Instead, it is up 
> to the object in question to adopt the protocol appropriately. Declaring 
> methods as @optional just means that you have a choice whether to implement 
> or not. Anyone wanting to call the method should first check if its 
> implemented with -respondsToSelector:

_______________________________________________

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

Reply via email to