• 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: Obj-C questions: protocol "casting"; random
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C questions: protocol "casting"; random


  • Subject: Re: Obj-C questions: protocol "casting"; random
  • From: j o a r <email@hidden>
  • Date: Fri, 21 Feb 2003 15:24:46 +0100

On Friday, Feb 21, 2003, at 15:14 Europe/Stockholm, email@hidden wrote:

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?

SomeReturnValue *val = [(id < MyProtocol >)obj someMethod: arg];

Read the Obj-C PDF that was installed with your development tools!

2) Are there any Random / RandomSeed functions provided anywhere in Cocoa or
CF?

Use the ones available in the plain C libraries, read the man-pages.

j o a r
_______________________________________________
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: 
 >Obj-C questions: protocol "casting"; random (From: email@hidden)

  • Prev by Date: Re: Obj-C questions: protocol "casting"; random
  • Next by Date: Re: 3 IB Qs: actions; view tags; NSWindow setFrame
  • Previous by thread: Re: Obj-C questions: protocol "casting"; random
  • Next by thread: 3 AppKit Qs: NSImageView; NSButton colours; NSMatrix "flip"
  • Index(es):
    • Date
    • Thread