233k views
5 votes
When a dynamic array with a class for a base type is declared, which constructor is called?

User Orkenstein
by
7.4k points

1 Answer

3 votes
The default constructor is called for each element of the array. So if you declare an array with 100 elements (object instantiations), the constructor is executed 100 times!
User Mavrosxristoforos
by
7.5k points