在Object-C中创建抽象类我最初是一个Java程序员,现在正在使用Object-C。我想创建一个抽象类,但在Object-C中这似乎是不可能的。这个是可能的吗?如果不是,我在目标C中离抽象类有多近?
3 回答

白板的微信
TA贡献1883条经验 获得超3个赞
[NSException raise:NSInternalInconsistencyException format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)];
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] userInfo:nil];

猛跑小猪
TA贡献1858条经验 获得超8个赞
- (id)someMethod:(SomeObject*)blah{ [self doesNotRecognizeSelector:_cmd]; return nil;}
- 3 回答
- 0 关注
- 420 浏览
添加回答
举报
0/150
提交
取消