Re: Mysterious warning (initialization from distinct Objective-C type)
Re: Mysterious warning (initialization from distinct Objective-C type)
- Subject: Re: Mysterious warning (initialization from distinct Objective-C type)
- From: Chris Hanson <email@hidden>
- Date: Wed, 21 Sep 2005 21:35:06 -0700
On Sep 21, 2005, at 6:26 AM, Mason Mark wrote:
NSDecimalNumber *now = [NSDecimalNumber numberWithDouble:
[NSDate timeIntervalSinceReferenceDate]];
NSDecimalNumber inherits the declaration of +numberWithDouble: from
its superclass, NSNumber. +[NSNumber numberWithDouble:] is defined
to return an NSNumber, not necessarily an NSDecimalNumber.
What you're doing in the line above is "downcasting" a less-specific
class (the NSNumber that +numberWithDouble: returns) to a more-
specific class (the NSDecimalNumber that you declared the variable to
be).
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden