Re: OT: Categories and alloc.
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.