C*******l 发帖数: 105 | 1 我们都知道Initialization list里的变量要按顺序列,但如果中间想跳过一个变量,
那么这个变量是通过default ctor来初始化吧?然后后边的继续用Initialization
list来初始化。我想确认一下这样写会不会到别的编译器下造成问题。 |
s*****k 发帖数: 604 | 2 what language you are talking about?
【在 C*******l 的大作中提到】 : 我们都知道Initialization list里的变量要按顺序列,但如果中间想跳过一个变量, : 那么这个变量是通过default ctor来初始化吧?然后后边的继续用Initialization : list来初始化。我想确认一下这样写会不会到别的编译器下造成问题。
|
C*******l 发帖数: 105 | 3 c++
【在 s*****k 的大作中提到】 : what language you are talking about?
|
P********e 发帖数: 2610 | 4
~~~~~~~什么书上写的
【在 C*******l 的大作中提到】 : 我们都知道Initialization list里的变量要按顺序列,但如果中间想跳过一个变量, : 那么这个变量是通过default ctor来初始化吧?然后后边的继续用Initialization : list来初始化。我想确认一下这样写会不会到别的编译器下造成问题。
|
t****t 发帖数: 6806 | 5 任何一本不太差的C++的书上都会提到
至于读者会不会一目十行的把它跳过, 那就是另一回事了
【在 P********e 的大作中提到】 : : ~~~~~~~什么书上写的
|
P********e 发帖数: 2610 | 6 hehe:)
The order of member construction is the order in which they are defined in
the class. Where they are in the construction list doesn't matters.
Why it should be in a order?
【在 t****t 的大作中提到】 : 任何一本不太差的C++的书上都会提到 : 至于读者会不会一目十行的把它跳过, 那就是另一回事了
|
a*****r 发帖数: 19 | 7 This is about morality instead of legality. Check out "effective C++".
Sometimes the order will bring up a
little problem.
【在 P********e 的大作中提到】 : hehe:) : The order of member construction is the order in which they are defined in : the class. Where they are in the construction list doesn't matters. : Why it should be in a order?
|