Re: theoretical - Protocols
Re: theoretical - Protocols
- Subject: Re: theoretical - Protocols
- From: Deirdre Saoirse Moen <email@hidden>
- Date: Sat, 26 May 2001 14:05:58 -0700
At 1:10 PM -0700 5/26/01, Bob Savage wrote:
Hi, I'm trying to learn about protocols, but I don't quite understand
something: why are there informal protocols? It seems like the best thing
would be to use the @protocol mechanism since it exists, but even Apple
doesn't do that sometimes (e.g. "NSTableDataSource informal protocol"). Is
this just being lazy, or is there a good reason to forgo the formal protocol
definition?
Suppose you don't want to implement the whole protocol? In a formal
protocol, you have to. In an informal one, you don't. If you're not
going to use those methods, why write code for them?
Another question: IF I were to define a protocol for objects that I get from
3rd parties (via Bundles), where should I define that protocol? Right in my
".h" file for the Class that uses these 3rd party-supplied objects?
From my own example (which I'll be uploading soon):
#import <Cocoa/Cocoa.h>
#include "plistArchiving.h"
@interface SillyDocument : NSDocument <plistArchiving>
--
_Deirdre Stash-o-Matic:
http://weirdre.com http://deirdre.net
Macintosh Developer (seeking work): Will work for Cocoa
"I love deadlines. I like the whooshing sound they make as they fly by."
- Douglas Adams