考考你 2022-6-12 (C++)
c吧
全部回复
仅看楼主
level 6
KrissiZH 楼主
以下代码输出结果是什么?简单解释下原因。
#include <stdio.h>
#include <list>
using namespace std;
class test
{
public:
test()
{
printf("test\n");
}
~test()
{
printf("~test\n");
}
};
int main()
{
list<test> arr;
test t;
arr.push_back(t);
arr.push_back(t);
return 0;
}
2022年06月12日 08点06分 1
level 10
不清楚 …… 但是 …… 好像原来见过一道类似的题。
2022年06月14日 13点06分 2
level 11
无参构造1次,复制构造2次,析构3次。
2022年06月15日 01点06分 3
level 1
楼上正解
2022年08月13日 03点08分 4
1