gpt4 book ai didi

objective-c - Objective-C 中的 super 到底是什么?

转载 作者:IT老高 更新时间:2023-10-28 11:36:18 25 4
gpt4 key购买 nike

据我所知,它是一个指向父类(super class)的指针。它与父类(super class)硬连线,而不是在运行时动态计算出来。想详细了解一下...

有人吗?

最佳答案

super

本质上,它允许您使用当前类的父类(super class)的实现。

对于 gritty details Objective-C 运行时:

[ super 消息]的含义如下:

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.

所以是的,它是静态的,不是在运行时确定的。

关于objective-c - Objective-C 中的 super 到底是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3095360/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com