Re: [Q] Do subclasses implementing same Protocol as super class also need to include it in declaration?
Re: [Q] Do subclasses implementing same Protocol as super class also need to include it in declaration?
- Subject: Re: [Q] Do subclasses implementing same Protocol as super class also need to include it in declaration?
- From: Chris Hanson <email@hidden>
- Date: Wed, 16 Jul 2008 19:31:29 -0700
On Jul 16, 2008, at 2:15 PM, Rick Mann wrote:
I have a class D that derives from class S. S derives from
NSObject<NSCoding>. Do I need to declare D as:
@interface D : S<NSCoding>
or can I leave off the <NSCoding> for the derived classes, and still
get appropriate warnings?
You can leave off the <NSCoding> for derived classes, but you won't
get warnings because you've said the superclass fulfills the contract
described by the protocol declaration.
Subclasses of NSView, for example, all conform to NSCoding because
NSView itself does. That's separate from whether subclasses of NSView
that want to encode or decode their own unique state need to override
NSView's implementation of the appropriate NSCoding methods.
-- Chris
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden