• 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: OT: Categories and alloc.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: Categories and alloc.


  • Subject: Re: OT: Categories and alloc.
  • From: Jorge Mederos <email@hidden>
  • Date: Tue, 09 Jul 2002 06:19:59 +0200
  • Organization: qarana...

This way, to request a new object following the protocol X without knowing its real class you just need to issue:

id<X> myx = [x newX];


Instead of [x newX] you can do [[[x class]alloc]init] and get rid of newX.
You can also do [[[bundle principalClass]alloc]init] to get the first x.


You are absolutely right. Just note that 'newX' gets type-checked against the protocol and the way an X object is obtained is opaque. My apologies for not being clear on this.

Regards, Jorge.
_______________________________________________
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.

  • Prev by Date: Re: Preview in Internet Explorer
  • Next by Date: How to get the "finger pointer" cursor?
  • Previous by thread: Re: OT: Categories and alloc.
  • Next by thread: Database Suggestions
  • Index(es):
    • Date
    • Thread