struct A{
void out()
{
cout << "A out" << endl;
}
A()
{
cout << "A constructed" << endl;
}
~A()
{
cout << "A destructed" << endl;
}
};
void test()
{
cout << "--begin--" << endl;
A a;
a.out();
cout << "--end--" << endl;
}
上述代码中,test
函数的输出结果是什么?请说明原因。