Re: Future Objective-C changes
Re: Future Objective-C changes
- Subject: Re: Future Objective-C changes
- From: David Cittadini <email@hidden>
- Date: Fri, 16 May 2003 16:49:08 +1000
That is good but what if I just want to support a Foo* and an int and
nothing else? At the moment I can only do this with multiple method
names, which is a bit strange as logically I actually have the same
method (name) but different parameter types. It would be nice if the
compiler could help in this area without all us thinkers having to come
up with interesting solutions to a problem solved many years ago :-).
David.
On Friday, May 16, 2003, at 04:41 PM, Julian Barkway wrote:
With regards to method overloading, I thought it may be useful to be
able to say:
-(int)doSomethingWithFoo:(Foo*)y;
-(int)doSomethingWithFoo:(int)y;
With method overloading the compiler could resolve most of the
parameter type issues without me having to create different method
names just because the parameter type is different.
David.
But you can already use something like:
-(int)doSomethingWithFoo:(id)y;
and invoke it with:
int bar;
Foo *f;
[x doSomethingWithFoo: [NSNumber numberWithInt: bar]];
[x doSomethingWithFoo: f];
or however you want. Not as elegant, perhaps, and you lose
compile-time type-checking but certainly doable.
Cheers,
Julian Barkway.
_______________________________________________
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.