【发布时间】:2011-02-22 01:33:08
【问题描述】:
如果您正在实现一个子类,您可以在您的实现中显式调用超类的方法,即使您已经覆盖了该方法,即:
[self overriddenMethod]; //calls the subclass's method
[super overriddenMethod]; //calls the superclass's method
如果你想从子类的实现之外的某个地方调用超类的方法,例如:
[[object super] overriddenMethod]; //crashes
这甚至可能吗?通过扩展,是否有可能在实现中上升不止一个级别,即:
[[super super] overriddenMethod]; //will this work?
【问题讨论】:
标签: iphone objective-c cocoa overriding superclass