本文共 654 字,大约阅读时间需要 2 分钟。
本文翻译自:
Possible Duplicate: 可能重复:
I got parameter and argument kind of mixed up and did not really pay attention to when to use one and when to use the other. 我得到了参数和参数类型的混合,并没有真正注意何时使用一个以及何时使用另一个。
Can you please tell me? 你能告诉我吗?
参考:
A parameter is the variable which is part of the method's signature (method declaration). 参数是变量,它是方法签名(方法声明)的一部分。 An argument is an expression used when calling the method. 参数是调用方法时使用的表达式。
Consider the following code: 请考虑以下代码:
void Foo(int i, float f){ // Do things}void Bar(){ int anInt = 1; Foo(anInt, 2.0);}
Here i
and f
are the parameters, and anInt
and 2.0
are the arguments. 这里i
和f
是参数, anInt
和2.0
是参数。
转载地址:http://hicnb.baihongyu.com/