K
kalki70
Hello,
I've been loooking for info about this issue, but I still can't find.
If I create an array of objects, are the constructors called in some
predefined order, or it is compiler-dependent?
For instance, having a class "A":
A a[10];
What I have seen is that constructor for a[0] is called, and then
operator = for the rest, but I supposed it is not a rule.
Can I trust that the element at position 0 of the array will always be
constructed first? I suppose I can't, but I would like to know your
opinions.
Thanks a lot,
Luis
I've been loooking for info about this issue, but I still can't find.
If I create an array of objects, are the constructors called in some
predefined order, or it is compiler-dependent?
For instance, having a class "A":
A a[10];
What I have seen is that constructor for a[0] is called, and then
operator = for the rest, but I supposed it is not a rule.
Can I trust that the element at position 0 of the array will always be
constructed first? I suppose I can't, but I would like to know your
opinions.
Thanks a lot,
Luis