Re: Obj-C questions: protocol "casting"; random
Re: Obj-C questions: protocol "casting"; random
- Subject: Re: Obj-C questions: protocol "casting"; random
- From: David Remahl <email@hidden>
- Date: Fri, 21 Feb 2003 15:23:49 +0100
fredagen den 21 februari 2003 kl 15.14 skrev email@hidden:
1) Is anything like this possible:
SomeReturnValue* val = [(SomeProtocol*)obj someMethod:anArg
someArg:otherArg];
That is, I know that the object should conform to a protocol, but I
don't know
what class it will be.
I want the compiler to recognize the method (which may have arguments)
and
understand what arguments and return values are expected. Should I
just pick
one of the conforming classes and "cast" to that?
This is a rtfm question...This should work
SomeReturnValue *val = [(id <SomeProtocol>)obj someMethod:anArg
somArg:otherArg];
2) Are there any Random / RandomSeed functions provided anywhere in
Cocoa or
CF?
You can use the standard C library functions, random() and srandom().
(man random).
/ rgds David
_______________________________________________
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.