• 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
Variable argument lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variable argument lists


  • Subject: Variable argument lists
  • From: Ken Tozier <email@hidden>
  • Date: Sat, 22 May 2004 03:22:20 -0400

I'm writing a class and would like to include an initialization method
like this one from NSDictionary:

+ (id) dictionaryWithObjectsAndKeys:(id) inFirst, ...

But I'm not really sure how to go about it. Could someone show me what
to do once I'm inside the initialization method?

+ (id) newFoo:(id) inFirst, ...
{
return [[[Foo alloc]
// is this the way to pass the arguments to the init method?
initFoo: inFirst]
autorelease];
}

- (id) initFoo:(id) inFirst, ...
{
self = [super init];
if (self)
{
// assuming I want to loop through the arguments
// what should go here?
}
}

Thanks,

Ken
_______________________________________________
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.


  • Follow-Ups:
    • Re: Variable argument lists
      • From: Jonathan Wight <email@hidden>
    • Re: Variable argument lists
      • From: Robert Martin <email@hidden>
  • Prev by Date: Re: Menu-less popup buttons
  • Next by Date: RE: Avoiding == and = mixup in if statements
  • Previous by thread: Re: NSTask problems with the path - The Code
  • Next by thread: Re: Variable argument lists
  • Index(es):
    • Date
    • Thread