#include "iostream.h"
Class A
{
PUBLIC:
A ()
{
COUT << "A ()" << endl;
}
Virtual ~ a ()
{
Cout << "~ a ()" << Endl;
}
}
Class B
{
PUBLIC:
B ()
{
COUT << "b ()" << endl;
}
Virtual ~ b ()
{
Cout << "~ b ()" << endl;
}
}
void main ()
{
A a a;
B B;
}
The above code output results:
A ()
B ()
~ B ()
~ A ()
As can be seen from the above results, the most declared object in C is first constructed, and finally destructive.