On Jul 11, 2008, at 7:39 PM, Steve Weller wrote:
Why is this addition needed? I don't see it used in other code. It's as though the compiler believes that conformance to a protocol implies that it exclusively provides those methods, which is not the idea of protocol conformance at all.

That is exactly the idea of the protocol.

By saying...

id mGrid;

... you would be indicating to the compiler that mGrid might potentially respond to any method ever seen. By adding...

id <FKPointArraySourcing> mGrid;

... you are telling the compiler to constrain the set of methods to exactly the set of methods found within the protocol declaration.

By adding the NSObject protocol....

@protocol FKPointArraySourcing <NSObject>

... you are effectively declaring that anything that implements FKPointArraySourcing will also behave like a standard NSObject. Most likely and most commonly, this will be achieved by subclassing NSObject, though you could also chose to implement all of the methods in <NSObject> to achieve conformance.

The alternative is to declare mGrid as always being a subclass of NSObject...

NSObject <FKPointArraySourcing> *mGrid;

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

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