• objectivec function


    - (return_type)instanceMethod1:(param1_type)param1_varName :(param2_type)param2_varName;
    
    - (return_type)instanceMethod2WithParameter :(param1_type)param1_varName andOtherParameter:(param2_type)param2_varName;

    The code above is roughly equivalent to the following C++

    return_type instanceMethod1(param1_type param1_varName, param2_type param2_varName);
    
     return_type instanceMethod2WithParameter(param1_type param1_varName, param2_type param2_varName=default);

    Note that instanceMethod2WithParameter:andOtherParameter: demonstrates the interleaving of selector segments with argument expressions, for which there is no direct equivalent in C/C++.   ----?

     

    函数参数语法

    :(参数类型) 参数名称

    In some cases (e.g. when writing system APIs) it is useful to add descriptive text before each parameter.

    描述文字:(参数类型) 参数名称

    函数调用:

    - (int)changeColorToRed:(float)red green:(float)green blue:(float)blue;
     
    [myColor changeColorToRed:5.0 green:2.0 blue:6.0];

    The syntax allows pseudo-naming of arguments.

     

    http://en.wikipedia.org/wiki/Objective-C



    签名:删除冗余的代码最开心,找不到删除的代码最痛苦!
  • 相关阅读:
    sed 练习
    正则表达式
    字符转换命令
    命令执行判断依据
    shell 操作环境
    选取命令
    排序命令
    命令别名与历史命令
    变量的学习
    防止恶意跳转
  • 原文地址:https://www.cnblogs.com/season2009/p/2538634.html
Copyright © 2020-2023  润新知