Re: NEWBIE: Why use protocols?
Re: NEWBIE: Why use protocols?
- Subject: Re: NEWBIE: Why use protocols?
- From: Cameron Hayne <email@hidden>
- Date: Wed, 18 May 2005 11:25:17 -0400
On 18-May-05, at 11:11 AM, Ben D. Jones wrote:
I don't get why or when the use of a protocol is a must for clarity
or function.
Protocols are useful when you have more than one class that you want
to use interchangeably in some circumstances. If you don't care about
what type of object is being handled as long as it understands
(implements) the "UpDown" protocol, then you can declare a parameter as:
id <UpDown>
instead of restricting it to a specific class.
In this way, protocols are useful in circumstances where multiple
inheritance might be used in C++
--
Cameron Hayne
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden