V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
helloword001
V2EX  ›  程序员

在 Objective-c 中如何创建一个抽象类?

  •  
  •   helloword001 · 2016-05-16 17:09:35 +08:00 · 3142 次点击
    这是一个创建于 2903 天前的主题,其中的信息可能已经有所发展或是发生改变。
    6 条回复    2016-05-17 10:03:19 +08:00
    helloword001
        1
    helloword001  
    OP
       2016-05-16 17:34:36 +08:00
    ??????
    Artail
        2
    Artail  
       2016-05-16 19:53:19 +08:00 via Android
    OC 没有抽象类。。
    juxingzhutou
        3
    juxingzhutou  
       2016-05-16 20:55:10 +08:00
    init 方法里抛出异常
    xingzhela
        4
    xingzhela  
       2016-05-16 21:39:46 +08:00
    @juxingzhutou 什么意思
    toono
        5
    toono  
       2016-05-17 00:15:05 +08:00
    没有抽象类,你可以写一个基类结合断言`NSAssert(false, @"Over ride in subclasses");`
    holy_sin
        6
    holy_sin  
       2016-05-17 10:03:19 +08:00
    参照 RACStream
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3851 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 04:16 · PVG 12:16 · LAX 21:16 · JFK 00:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.