Skip to content

在 Obj-C 中为什么叫发消息而不叫函数调用? #58

@tbfungeek

Description

@tbfungeek

这道题其实有点玩文字游戏的意味,从英文翻译过来的很难说为什么,只是一个名称而已,主要看先入为主的概念,从个人理解函数调用指的是在编译的时候就确定了,调用哪个函数实体,而发送消息指的只是将消息发送给某个目标对象,发送过程中还可以进行方法,决议,以及消息转发等处理,所以最终执行的方法不是静态固定的。Obj-C 的方法调用正是通过后者这种模式发送消息给某个对象,对象根据发送过来的消息(SEL)做动态响应。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions