You can specify that a class adopts a protocol by defining it as:

@interface ClassB : ClassA <Check>
{
...
}
...
@end

This will tell the compiler that ClassB implements the Check protocol. You can put multiple protocols by separating them with a comma:


@interface ClassB : ClassA <Check, someotherproto>
{
...
}
...
@end

This will stop compiler warnings and will also warn if a class you defined to use the protocol doesn't have an implementation for the method(s) in that protocol.


On Apr 28, 2008, at 6:00 PM, K. Darcy Otto wrote:

I need to have a subclass optionally extend a method already in the superclass. After some research, my best guess is that an optionally defined protocol is the best way to go about this. So, what I have in the superclass is:

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to