本文介绍了“将消息发送为零"是什么意思?是什么意思,为什么是特例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始阅读Objective-C教程,其中有一节向nil发送消息":

I just started reading the Objective-C tutorials, and there is a section on "sending a message to nil":

这是什么意思?我似乎无法遵循.

What does this mean? I can't seem to follow it.

推荐答案

  • nil基本上是一个空指针(即它是存储在指针中的数字零).
  • 所有发送到nil的消息都是合法的(它们不会导致崩溃),但是它们什么也没做.
  • 所有返回nil的消息均返回nil,或者0、0.0,或NO,具体取决于返回类型.
  • 这篇关于“将消息发送为零"是什么意思?是什么意思,为什么是特例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 02:49
查看更多