360校园招聘笔试题

综合知识·iOS工程师 · 历年真题改编 · 题号 40783
单选题综合知识iOS工程师难度 3真题改编 · 2023中大厂

题目

下面代码执行后的输出结果为( )? @interface Person:NSObject{ NSString* name; } - (void) setName:(NSString*) yourName; @end @interface PersonMe:Person { NSUInteger age; } - (void) setAge:(NSUInteger) age; - (void) setName:(NSString*) yourName andAge:(NSUInteger) age; @end @implementation PersonMe - (void) setName:(NSString*) yourName andAge:(NSUInteger) age { [self setAge:age]; [super setName:yourName]; NSLog(@"self' class is %@", [self class]); NSLog(@"super' class is %@", [super class]); } @end int main(int argc, char* argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init] PersonMe* me = [[PersonMe alloc] init]; [me setName:@"asdf" andAge:18]; [me release]; [pool drain]; return 0; }

选项4 个

Aself' class is PersonMe super' class is Person
Bself's class is PersonMe super' class is PersonMe
Cself' class is Person super' class is PersonMe
Dself's class is Person super' class is Person
🔒 答案与解析:登录后可查看本题答案、解析与考点讲解,并可在线作答自动判分 登录 / 注册
‹ 上一题 全部专题 下一题 ›

同类型题目综合知识·iOS工程师 · 继续练习

题目免费浏览 · 整套练习与模拟考登录后开始 · 答案与解析登录后可见