开发者

XCode - Compiler does not alert about a type-mismatch

Can you just tell me why this ...... compiler does not alert me about a possible type mismatch here ?

NSHour* H1; // My object

if (H1 == nil) doSomething
else H1 = [NSString stringWithFormat:@"%@%@", H1, @":00"];  --- Here : affecting an NS开发者_开发知识库String* to an NSHour*


Because the declaration says it returns id:

+ (id)stringWithFormat:(NSString *)format, ...

And id can easily be assigned to anything.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜