在Objective-C中超级到底是什么? [英] What exactly is super in Objective-C?
问题描述
据我所知,它是超类的指针.它与超类硬连接,并且无法在运行时动态找出.想更详细地了解它...
As far as I know, it's a pointer to the superclass. It's hard-wired with the superclass, and not dynamically figured out at runtime. Would like to know it more in detail...
有人吗?
推荐答案
Essentially, it allows you to use the implementations of the current class' superclass.
当遇到方法调用时, 编译器生成对以下其中一项的调用 函数objc_msgSend objc_msgSend_stret,objc_msgSendSuper, 或objc_msgSendSuper_stret.留言内容 发送到对象的超类(使用 超级关键字)通过以下方式发送 objc_msgSendSuper;其他消息是 使用objc_msgSend发送.方法 具有数据结构作为返回值 使用objc_msgSendSuper_stret发送 和objc_msgSend_stret.
When it encounters a method call, the compiler generates a call to one of the functions objc_msgSend, objc_msgSend_stret, objc_msgSendSuper, or objc_msgSendSuper_stret. Messages sent to an object’s superclass (using the super keyword) are sent using objc_msgSendSuper; other messages are sent using objc_msgSend. Methods that have data structures as return values are sent using objc_msgSendSuper_stret and objc_msgSend_stret.
是的,它是静态的,不是是在运行时确定的.
So yes, it is static, and not determined at runtime.
这篇关于在Objective-C中超级到底是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!