zoukankan      html  css  js  c++  java
  • IT English Collection(16) of Message

    1 前言

        本文介绍了关于Objective-C中的消息机制,详情如下。

        转载请注明出处:http://blog.csdn.net/developer_zhang

    2 详述

    2.1 原文

        A message is the name of a method, and any parameters associated with it, that are sent to, and executed by, an object. To get an object to do something, you send it a message telling it to apply a method. In Objective-C, you specify the object (known as the receiver of the method) and the message being sent to that object by enclosing the message expression in brackets. For example, this message expression tells the myRectangle object to perform its display method:

    [myRectangle display];

    (The expression is followed by a semicolon (;) as is normal for any line of code in C.)

        The method name in a message serves to select a method implementation—when a message is sent, the runtime system selects the appropriate method from the receiver’s repertoire and invokes it. For this reason, method names in messages are often referred to as selectors.

        Methods can also take parameters, also called arguments. A message with a single argument affixes a colon (:) to the selector name and puts the parameter right after the colon. This construct is called a keyword; a keyword ends with a colon, and a parameter follows the colon. A method that takes multiple parameters has multiple keywords, each followed by a colon.

    [myRectangle setLineWidth:0.25];
    [myRectangle setWidth:20.0 height:50.0];


    2.2 生词

    associated with 有关系;与相联系

    execute ['eksɪkjuːt]vt. 实行;执行

    specify ['spesɪfaɪ] vt. 指定;详细说明

    enclose [ɪn'kləʊz; en-] vt. 围绕;装入

    expression [ɪk'spreʃ(ə)n; ek-] n. 表现,表示

    bracket ['brækɪt] n. 支架;括号

    semicolon [,semɪ'kəʊlən; -'kəʊlɒn] n. 分号

    appropriate [ə'prəʊprɪət] adj. 适当的

    repertoire ['repətwɑː] n. 全部节目;计算机指令系统

    affixes n. [语] 词缀

    colon ['kəʊlən] n. 冒号

    construct [kən'strʌkt] vt. 建造,构造

    3 结语

        以上是所有内容,希望对大家有所帮助。

  • 相关阅读:
    数组名与指向数组的指针
    如何实现带可变长参数的函数
    assert()的使用
    参数入栈的顺序以及栈/堆的生长顺序
    指向函数的指针
    各变量入栈顺序
    数组与指针
    C中空指针、NULL与0
    C中为什么不能用==比较字符串?
    在命令行窗口中输入EOF
  • 原文地址:https://www.cnblogs.com/suncoolcat/p/3347803.html
Copyright © 2011-2022 走看看