Why does Objective-C allow successful invocation of null objects?

What is the use of this (besides the part without failures)? I want to know in terms of the thinking process behind such a design.

+4
source share
2 answers

This is a design choice. And in Objective-C terminology, one “sends messages” to objects instead of “call methods”. So you can say that sending a message to an object that does not exist is simply not affected. If you turn to a real letter to a person who does not exist, no one will receive it, no one will answer or do nothing.

+5
source

Java, , "", java.lang.NullPointerException, .

, , , : , - , .

, ( , ) , - .

+2

All Articles