M*********t 发帖数: 257 | 1 Question: Which of the following statements regarding functions' default
arguments in C++ are correct?
A. Default arguments cannot be of pointer type.
B. Default arguments exist in the global heap and not on the function's
stack.
C. Default arguments cannot be of a user-defined type.
D. Default arguments can never precede non-default arguments.
E. Default arguments are not considered for generating the function's
signature.
multiple choices up to 3 could be correct
Thank |
x**p 发帖数: 105 | 2 E
【在 M*********t 的大作中提到】 : Question: Which of the following statements regarding functions' default : arguments in C++ are correct? : A. Default arguments cannot be of pointer type. : B. Default arguments exist in the global heap and not on the function's : stack. : C. Default arguments cannot be of a user-defined type. : D. Default arguments can never precede non-default arguments. : : E. Default arguments are not considered for generating the function's : signature.
|
j******n 发帖数: 271 | 3 ???
【在 x**p 的大作中提到】 : E : :
|
m********0 发帖数: 2717 | 4 agree,
A, B, C, D are wrong anyway.
【在 x**p 的大作中提到】 : E : :
|
b********u 发帖数: 63 | 5 D is correct.
E is wrong - default arguments still appear in the function name mangling.
The compiler automatically push them in the stack |
x**p 发帖数: 105 | 6 u r right.
【在 b********u 的大作中提到】 : D is correct. : E is wrong - default arguments still appear in the function name mangling. : The compiler automatically push them in the stack
|
m********0 发帖数: 2717 | 7 恩。D是对的。
我原来以为这样的写法编译器会接受,只是default失去意义而已。
试了一下两个编译器,这样是不接受的。提示后面的非default
参数缺少default value。
想当然了
【在 b********u 的大作中提到】 : D is correct. : E is wrong - default arguments still appear in the function name mangling. : The compiler automatically push them in the stack
|
s*****r 发帖数: 773 | 8 B 不对么?
default arguments are static binding.
【在 M*********t 的大作中提到】 : Question: Which of the following statements regarding functions' default : arguments in C++ are correct? : A. Default arguments cannot be of pointer type. : B. Default arguments exist in the global heap and not on the function's : stack. : C. Default arguments cannot be of a user-defined type. : D. Default arguments can never precede non-default arguments. : : E. Default arguments are not considered for generating the function's : signature.
|
d********e 发帖数: 132 | |