On Oct 2, 2008, at 2:43 PM, Brad Gibbs wrote:
I'm working through the XSViewController example project from KATIDev and I came across this line:

[(ColorView*)[self view] setBackgroundColor:[[NSColor greenColor] colorWithAlphaComponent:.5]];

and realized I don't understand (ColorView*). It looks like it's declaring a pointer to an object, but it's followed by a method. Could somebody tell me the name of the function (ColorView*) is performing so I can look it up and figure it out?

There is no function.

It is declaring that the result of the [self view] sub-expression should be treated as a pointer to a ColorView by the compiler.

Nothing more, nothing less.

It is just a typecast to likely suppress a compiler warning because whoever defined -view likely defined it as returning a reference to an NSView, which does not respond to -setBackgroundColor:

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to