Skip navigation.
 
mlRe: NSForm validation
FROM : James Powell
DATE : Wed Nov 13 14:09:04 2002

Aha.  You are correct.  I am surprised, because numberWithInt returns
an NSNumber * and  NSDecimalNumber is a subclass of NSNumber.  In C++,
the compiler does not downcast automatically.  It looks like the
Objective C compiler accommodates downcasts.

This makes sense, given the dynamic nature of Objective C.  It is a
leap of faith to assume that the instance returned by numberWithInt is
actually an NSDecimalNumber instance, but no more than to assume that a
message is defined for a class when it isn't present in the header.

I am also able to answer my remaining question.  I had a silly
unnecessary 'const' keyword in there.  The preferences controller now
compiles without warnings.  Yahoo!  Thank you for your help.

  James


Related mailsAuthorDate
mlNSForm validation James Powell Nov 12, 22:40
mlRe: NSForm validation James Powell Nov 13, 11:31
mlRe: NSForm validation Andreas Mayer Nov 13, 13:23
mlRe: NSForm validation James Powell Nov 13, 14:09
mlRe: NSForm validation Andreas Mayer Nov 13, 15:49
mlRe: numberWithInt (was Re: NSForm validation) Cameron Hayne Nov 13, 16:35
mlRe: numberWithInt (was Re: NSForm validation) Jeff Disher Nov 13, 16:52
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 13, 17:16
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 13, 17:45
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 13, 17:53
mlRe: numberWithInt (was Re: NSForm validation) James Powell Nov 13, 18:11
mlRe: numberWithInt (was Re: NSForm validation) Andy Lee Nov 13, 20:08
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 14, 06:49
mlRe: numberWithInt (was Re: NSForm validation) Andy Lee Nov 14, 08:30
mlRe: numberWithInt (was Re: NSForm validation) Andreas Mayer Nov 14, 13:17