参数和形参之间是什么关系?
What is the relationship between arguments and formal parameters?
将一个方法的形参设置为常量
清单6 .int形参定义类。
最后,清单6显示了int形参值的形参定义子类的部分实现。
Finally, Listing 6 shows a partial implementation of the parameter definition subclass for int parameter values.
最后剩下的部分就是处理错误报告(例如一个未知的形参标记字符或者一个超出范围的数字值)。
The only part remaining is the handling of error reporting (such as an unknown parameter flag character or a numeric value out of range).
您还可以指示某个形参是可选的。
在第三对中,形参列表只有默认实参不同。
In the third pair, the parameter lists differ only in their default arguments.
编译器将选出形参个数和类型都与实参匹配的函数。
The compiler selects those functions that have the required number of parameters and for which the argument types match the parameter types.
将指定实参连接(绑定)到静态结构图中某个模板的形参。
Connects (binds) designated arguments to a template's formal parameters in your Static Structure diagram.
您可以将形参当作一个停车位,而将实参当作一辆汽车。
You can think of the parameter as a parking space and the argument as an automobile.
如果该标识符是形参或局部变量,则使用自动存储声明它。
If the identifier is a formal parameter or local variable, declare it with auto storage.
构造函数的形参指定了创建类类型对象时使用的初始化式。
The constructor's parameters specify the initializers that may be used when creating objects of the class type.
在整个标准库中,经常使用形参为一对迭代器的构造函数。
The constructors that take a pair of iterators are an example of a common form used extensively throughout the library.
因为数组不能复制,所以无法编写使用数组类型形参的函数。
Because we cannot copy an array, we cannot write a function that takes an array type parameter.
通常,将数组形参直接定义为指针要比使用数组语法定义更好。
It is usually a good idea to define array parameters as Pointers, rather than using the array syntax.
框架的边上要标明函数的名字,框内填写函数内部的形参和变量。
A frame is a box with the name of a function beside it and the parameters and variables of the function inside it.
对于上述几种情况,有效的解决办法是将形参定义为引用或指针类型。
In these cases we can instead define the parameters as references or Pointers.
转换函数必须是成员函数,不能指定返回类型,并且形参表必须为空。
A conversion function must be a member function. The function may not specify a return type, and the parameter list must be empty.
在调用过程时,您提供的各个实参分别对应于过程中定义的一个形参。
When you call a procedure, each argument you supply corresponds to one of the parameters defined in the procedure.
由于忽略了数组长度,形参定义中如果包含了数组长度则特别容易引起误解。
Because an array dimension is ignored, including a dimension in a parameter definition is particularly misleading.
可行函数必须满足两个条件:第一,函数的形参个数与该调用的实参个数相同;
To be viable, a function must meet two tests. First, the function must have the same number of parameters as there are arguments in the call.
在向函数传递大型对象时,需要使用引用形参,这是引用形参适用的另一种情况。
The other circumstance in which reference parameters are useful is when passing a large object to a function.
可以用单个实参来调用的构造函数定义了从形参类型到该类类型的一个隐式转换。
A constructor that can be called with a single argument defines an implicit conversion from the parameter type to the class type.
出现在相同作用域中的两个函数,如果具有相同的名字而形参表不同,则称为重载函数。
Two functions that appear in the same scope are overloaded if they have the same name but have different parameter lists.
根据实参个数选出潜在的可行函数后,必须检查实参的类型是否与对应的形参类型匹配。
Having used the number of arguments to winnow the potentially viable functions, we must now look at whether the argument types match those of the parameters.
一个类可以有多个构造函数,每个构造函数必须有与其他构造函数不同数目或类型的形参。
A class can have multiple constructors. Each constructor must differ from the others in the number or types of its parameters.
一个类可以有多个构造函数,每个构造函数必须有与其他构造函数不同数目或类型的形参。
A class can have multiple constructors. Each constructor must differ from the others in the number or types of its parameters.
应用推荐