Re: Objective-C default arguments??
Re: Objective-C default arguments??
- Subject: Re: Objective-C default arguments??
- From: Malcolm Sharman <email@hidden>
- Date: Sat, 01 Nov 2003 17:18:35 +1000
I just realised that I'm thinking in C++ rather than plain C, so it that
regard it won't work.
I also realised that there is a way to do what I want to do nearly as
easily.
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.
Malcolm
on 2003-11-01 04:51 PM, Malcolm Sharman at email@hidden wrote:
>
Hi
>
>
I'm reasonably new to Objective-C and cocoa and I'm trying to make a simple
>
instance method of a class that takes a number of arguments.
>
>
-(void)initWithFile:(NSString *)path=@"" :(BOOL)setMovie=NO;
>
>
The above line of code is what I'm trying to do similar to what I can do in
>
plain c
>
void doSomething(int num1 = 1, int num2 = 2);
>
>
Am I way off track?? Do I have to use a variable argument list in Objective-C
>
to do the same thing??
>
>
I can probably get around this if I can't use default arguments by using two
>
methods, but it would be nicer to do it this way
>
Thanks for any help
>
>
Malcolm
_______________________________________________
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.