I'm researching Object-Oriented Programming in Swift and I figured a great place to start would be NSObject
, since all objects inherit from this base class. In Apple's documentation for NSObject
, there are areas that refer to a "receiver". Does "receiver" mean an instance of NSObject
?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It refers to Objective-c's paradigm of "sending messages" to objects. In that world, a "method" isn't REALLY a method, it's just the object saying, "Hey, if someone sends me this message (a string that matches that method name), I'll respond to it." i.e. that object is the "receiver" for the message. So yes, in the documentation you mention, NSObject is the receiver and the methods you see there are the "messages".