Re: Protocol variables
Re: Protocol variables
- Subject: Re: Protocol variables
- From: Julian Pellico <email@hidden>
- Date: Tue, 27 Jul 2004 19:15:46 -0700
Hi,
Theodore, you will have to elaborate on your intent. Can an object
have a pointer to another object that conforms to a specified
protocol? Yes. Can an object have a pointer to a Protocol object? Yes.
These are two very different things. To do the former, you would use:
id<SomeProtocol> someObject;
You are asking the compiler to ensure to the best of its ability that
someObject conforms to SomeProtocol.
You can also have a pointer to a Protocol object, but I think this is
less likely to be your intent, because what you can do with such an
object is rather limited. You can only get a Protocol * with the
@protocol directive. To see the limited methods of the Protocol
class, look at
http://www.channelu.com/NeXT/NeXTStep/3.3/nd/GeneralRef/15_RunTime/Classes/Protocol.htmld.
Does this help any?
Julian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.