Re: Protocol compiler hint vs no hint....
Re: Protocol compiler hint vs no hint....
- Subject: Re: Protocol compiler hint vs no hint....
- From: Bob Ippolito <email@hidden>
- Date: Sun, 10 Jul 2005 09:57:29 -1000
On Jul 10, 2005, at 8:38 AM, Frederick C. Lee wrote:
Greetings:
I came across the following piece of code written by Joar
Wingfors on Tue Dec 02 2003 {MainController.m of
SubviewTableViewRuleEditor }.
He uses a protocol hint to aid 'static typing' (via Cocoa
Programming book by Scott Anguish et al).
I decided to static code via the 2nd method, using explicit
(NSMenuItem *).
- (void) changeRuleType:(id < NSMenuItem >) sender { // Notice
the < protocol > hint
vs...
- (void) changeRuleType:(NSMenuItem *) sender { // no hint.
------
Question: Is there any benefit of using a protocol vs just
declaring the static type?
Protocols and classes are different things entirely and it's very
rare that you'll have to ask this question because it's typically
obvious which you should do (from the documentation or headers). In
this case, the class is the correct type to declare, because the
NSMenuItem protocol is deprecated. When in doubt, look it up.
-bob
_______________________________________________
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