Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concrete Protocols




Am 31.10.2007 um 11:51 schrieb Chris Hanson:

On Oct 31, 2007, at 1:27 AM, Philip Mötteli wrote:

Has anybody found any documentation about concrete protocols? (That was supposed to be one new feature in Objective-C 2.0.)

Protocols in Objective-C 2.0 can have methods that are marked as @required and @optional for classes that conform to the protocol, making them useful for describing delegate methods where protocols weren't before.


Is this what you're referring to?

I'm referring to:

Concrete Protocols
Objective-C, just like Smalltalk, doesn’t have multiple inheritance. This was a design decision, as it was with Java, because multiple inheritance can cause headaches. Instead, Objective-C has categories, which allow methods to be added to an existing class, and protocols that specify interfaces.


Objective-C 2.0 adds the concept of a concrete protocol. Whereas a protocol is a definition of an interface, a concrete protocol adds some implementation detail as well. If the class that adopts the protocol doesn’t provide its own implementation, it will get the default implementation from the protocol.

These features can be combined effectively with @optional methods in a protocol to provide a default implementation of @optional methods, but allow an implementer to replace them with a more useful method.


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Concrete Protocols (From: Philip Mötteli <email@hidden>)
 >Re: Concrete Protocols (From: Chris Hanson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.