Wednesday 22 February 2012

Write about the sequence in which objects in an array are destructor?

The destructor is executed in the reverse order of constructor. Firstly, the objects are constructed, methods are invoked on them, and then they are destructed.
In the following example, 
the order for destructors will be b[19], b[18],b[17],b[16],b[15],b[14],b[13],b[12], b[ll], b[10]:
void def()
{
Bat b[20];
}