为什么 Objective-C 中的方法调用称为消息传递?
是否就像我在两个对象之间“传递消息”,并且如果它们碰巧在不同的线程中实例化,那么调用的方法仍然会在其对象的线程中运行?
Is it like if I "pass a message" between two objects and if they happened to be have been instantiated in different threads then the invoked method would still run in its object's thread?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调用方法是在编译时解决的,并且该方法预计会在运行时出现。消息传递在运行时解决,接收者对象不需要了解如何处理消息。
Objective-C 中的术语“消息传递”与线程无关。
我在这里找到了一篇关于此主题的好文章: http://iskren.info/reading /info/ObjC/reading/dynamite.html
Calling a method is resolved at compile time and the method can be expected to be present at run time. Message passing is resolved at run time and the receiver object does not need to understand how to handle the message.
The term "message passing" in Objective-C does not have anything to do with threading.
I found a good article about this topic here: http://iskren.info/reading/info/ObjC/reading/dynamite.html