Does new[] call default constructor in C++?

前端 未结 3 673
一生所求
一生所求 2020-11-29 23:54

When I use new[] to create an array of my classes:

int count = 10;
A *arr = new A[count];

I see that it calls a default constructor of

3条回答
  •  旧巷少年郎
    2020-11-30 00:22

    int is not a class, it's a built in data type, therefore no constructor is called for it.

提交回复
热议问题