• 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: Objective-C default arguments??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C default arguments??


  • Subject: Re: Objective-C default arguments??
  • From: Sherm Pendley <email@hidden>
  • Date: Sat, 1 Nov 2003 02:28:58 -0500

On Nov 1, 2003, at 2:18 AM, Malcolm Sharman wrote:

Instead of -(void)initWithFile:(NSString *)path=@""
setmovie:(BOOL)setMovie=NO;

I use
-(void)initWithFile:(NSString *)path setMovie:(BOOL)setMovie
And
-(void)initWithFile:(NSString *)path
{
[self initWithFile:path setMovie:NO];
}

It is kind of a hack, but it works.

It's not really a hack; it's the recommended way of doing it. Take a look at the following page, in the section "Designated Initializer."

<http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ 4objc_runtime_overview/chapter_4_section_2.html>

sherm--
_______________________________________________
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: 
 >Re: Objective-C default arguments?? (From: Malcolm Sharman <email@hidden>)

  • Prev by Date: Re: Objective-C default arguments??
  • Next by Date: Re: Objective-C default arguments??
  • Previous by thread: Re: Objective-C default arguments??
  • Next by thread: Re: Objective-C default arguments??
  • Index(es):
    • Date
    • Thread