Login
Remember
Register
Ask a Question
What's the order in which the objects in an array are destructed?
0
votes
asked
Jun 11, 2020
in
C Plus Plus
by
Robindeniel
What's the order in which the objects in an array are destructed?
#array-objects
#objects-array
#destruction-array
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jun 11, 2020
by
sharadyadav1986
Objects in an array are destructed in the reverse order of construction: First constructed, last destructed.
In the following Example, the order for destructors will be a[9], a[8], …, a[1], a[0]:
voiduserCode()
{
Car a[10];
...
}
Pointers
...