Latest version of Objective-C and XCode (4.4).
I have a code snippet and I cannot understand why I'm able to use some lines, let me explain :
// For understanding purpose : (NSMutableArray*)_programStack
id l_topItemOnStack = [_programStack lastObject];
if([l_topItemOnStack isKindOfClass:[NSNumber class]])
{
return [l_topItemOnStack doubleValue];
}
My question : since my l_topItemOnStack
is of type id
and I didn't cast it into a NSNumber
, how am i able to use the [l_topItemOnStack doubleValue]
.
I guessed that I had to cast it to NSNumber first to access the NSNumber methods...
What am I missing here ?