Implement a pure virtual method in Objective-C

前端 未结 6 1543
清酒与你
清酒与你 2020-12-02 18:22

I want to go to there. Seriously though, how does one implement a pure virtual method in an \"Apple\" way? Do you use a Protocol with your base class and throw exceptions on

6条回答
  •  时光说笑
    2020-12-02 19:07

    You should use the:

    - (void)doesNotRecognizeSelector:(SEL)aSelector method. 
    

    As noted by Apple, here: https://developer.apple.com/library/mac/#documentation/cocoa/reference/Foundation/Classes/NSObject_Class/Reference/Reference.html

提交回复
热议问题