In C ++, a MyClass size 4 array is four actual objects. This is similar to a four-member structure of this type, although of course you gain access to members using a different syntax and there are other technical differences.
So, the definition of this array leads to the construction of 4 objects for the same reason (and under approximately the same circumstances) that define one object of this type, makes it build.
Compare this state of affairs with another programming language: in Java, a MyClass array of size 4 is just four pointers that are allowed to be null. Therefore, creating it does not create any MyClass objects.
source share