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
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 mails | Author | Date |
|---|---|---|
| James Powell | Nov 12, 22:40 | |
| James Powell | Nov 13, 11:31 | |
| Andreas Mayer | Nov 13, 13:23 | |
| James Powell | Nov 13, 14:09 | |
| Andreas Mayer | Nov 13, 15:49 | |
| Cameron Hayne | Nov 13, 16:35 | |
| Jeff Disher | Nov 13, 16:52 | |
| Andreas Mayer | Nov 13, 17:16 | |
| Andreas Mayer | Nov 13, 17:45 | |
| Andreas Mayer | Nov 13, 17:53 | |
| James Powell | Nov 13, 18:11 | |
| Andy Lee | Nov 13, 20:08 | |
| Andreas Mayer | Nov 14, 06:49 | |
| Andy Lee | Nov 14, 08:30 | |
| Andreas Mayer | Nov 14, 13:17 |






Cocoa mail archive

