• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Protocol variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Protocol variables (From: "Theodore H. Smith" <email@hidden>)
 >Re: Protocol variables (From: Nick Zitzmann <email@hidden>)
 >Re: Protocol variables (From: Prachi Gauriar <email@hidden>)

  • Prev by Date: Re: earliest code that runs?
  • Next by Date: Re: Bindings - Preserving the Modal/Controller
  • Previous by thread: Re: Protocol variables
  • Next by thread: [OT] disable Xcode's undo warning?
  • Index(es):
    • Date
    • Thread