You can allocate a multidimensional array using new
//...constructor, destructor, etc.
A (*pa)=new A; // three dimensional array
m=pa.j; // access member of array's first element
m=pa.j; // access member of array's last element
The function func() allocates a three-dimensional array of A objects called pa. How do you delete a dynamically-allocated multidimensional array? It's simple: no matter how many dimensions the array has, you always use delete to destroy it, as follows: