October 1997
Intermediate to advanced
800 pages
20h 48m
English
C++ arrays may contain objects as well as built-in types. Two formats allocate memory for class object arrays from either the stack or data area.
Type name[size] = { init_list }; Type name[size1][size2][sizeN] = { init_list };
The rules for size are the same as the rules for arrays of built-in types (see “Arrays” on page 35). The optional brace-enclosed init_list typically contains constructors to build each object in the array. If you do not initialize an array, the compiler calls default constructors to initialize each array element. When you initialize arrays of class objects, you must include braces with init_list.
Likewise, two formats with operator new allocate memory for dynamic class object arrays in free ...