17.5.1 Method parameters
日期:2007年5月3日 作者: 查看:[大字体 中字体 小字体]-
The parameters of a method, if any, are declared by the method?s
formal-parameter-list.
formal-parameter-list:
fixed-parameters
fixed-parameters , parameter-array
parameter-array
fixed-parameters:
fixed-parameter
fixed-parameters , fixed-parameter
fixed-parameter:
attributesopt parameter-modifieropt type identifier
parameter-modifier:
ref
out
parameter-array:
attributesopt params array-type identifier
The formal parameter list consists of one or more comma-separated
parameters of which only the last may be a
parameter-array.
A fixed-parameter consists of an optional set of attributes (§24), an
optional ref or out modifier, a type, and an
identifier. Each fixed-parameter declares a parameter of the given type
with the given name.
A parameter-array consists of an optional set of attributes (§24), a
params modifier, an array-type, and an
identifier. A parameter array declares a single parameter of the given
array type with the given name. The arraytype
of a parameter array must be a single-dimensional array type (§19.1). In a
method invocation, a parameter
array permits either a single argument of the given array type to be
specified, or it permits zero or more
arguments of the array element type to be specified. Parameter arrays are
described further in §17.5.1.4.
A method declaration creates a separate declaration space for parameters
and local variables. Names are
introduced into this declaration space by the formal parameter list of the
method and by local variable
declarations in the block of the method. All names in the declaration space
of a method must be unique;
otherwise, a compile-time error results.
Chapter 17 Classes
229
A method invocation (§14.5.5.1) creates a copy, specific to that
invocation, of the formal parameters and local
variables of the method, and the argument list of the invocation assigns
values or variable references to the newly
created formal parameters. Within the block of a method, formal parameters
can be referenced by their identifiers
in simple-name expressions (§14.5.2).
There are four kinds of formal parameters:
? - [1] [2] [3] [4] [5] [6] 下一页
-
- 17.5.1 Method parameters 相关文章:
- ·17.5.1 Method parameters
- 17.5.1 Method parameters 相关软件
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
下一篇:17.4 Fields
精品推荐
热点TOP10
- ·图象处理中的边缘检测------canny算子
- ·EZ-USB 68013A开发指南
- ·数值计算程序大放送-特征值和特征向量
- ·ARM的嵌入式Linux移植体验之BootLoader
- ·Visual C++ ADO数据库编程入门
- ·智能手机Smartphone开发导语
- ·利用 wordXP 实现自动排班
- ·[分形]DLA团簇模型的摸拟
- ·DENX U-Boot及Linux使用手册
- ·Static和Final修饰类属性变量及初始化
- ·BPEL的异常管理
- ·看Vue 5 Esprit函数的节点与链接详情
- ·初学者全面接触学习jquery(译文)
- ·LinQ学习之旅 从整型数组中找出偶数
- ·Enterprise Library 快速入门
- ·CVS源代码库服务器建立和权限配置
- ·Visual FoxPro 9.0 SP2正式版下载
- ·VS2005控件的问题解决办法
- ·Cookie是什么?用法是怎样?与SESSION有什么区别?
- ·J2SE API读取Properties文件的六种方法
