On Mar 15, 2010, at 3:49 PM, Jeff Laing wrote: > But my protocol only wanted to define the methods in my protocol - a nice > clean Interface definition that's independent of all other definitions. > After all, Apple might add some non-optional methods to NSObject (ok, that's > unlikely) that all objects implementing my protocol would suddenly fail to > compile on.
Unless you are going to be working with objects that don't descend from NSObject (the class) then extending NSObject (the protocol) should not be an issue. From the documentation on the NSObject Protocol: "The NSObject protocol groups methods that are fundamental to all Objective-C objects. If an object conforms to this protocol, it can be considered a first-class object. Such an object can be asked about its: • Class, and the place of its class in the inheritance hierarchy • Conformance to protocols • Ability to respond to a particular message In addition, objects that conform to this protocol—with its retain, release, and autorelease methods—can also integrate with the object management and deallocation scheme defined in Foundation (for more information see, for example, Memory Management Programming Guide for Cocoa). Thus, an object that conforms to the NSObject protocol can be managed by container objects like those defined by NSArray and NSDictionary. The Cocoa root class, NSObject, adopts this protocol, so all objects inheriting from NSObject have the features described by this protocol." On a practical note, many of the protocols that you work with in Cocoa and Cocoa Touch also declare that they extend NSObject, so this assumption has already been made for you in many places. -- David Duncan Apple DTS Animation and Printing _______________________________________________ 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