I need help to creater allocate space.
Here is what I have
Qt Code:
  1. class Array
  2. {
  3. friend ostream &operator<<( ostream &, const Array & );
  4. friend istream &operator>>( istream &, Array & );
  5. public:
  6. Array( int = 10,int =10 );
  7. Array( const Array & );
  8. ~Array();
  9. // inequality operator; returns opposite of == operator
  10. bool operator!=( const Array &right ) const
  11. {
  12. return ! ( *this == right ); // invokes Array::operator==
  13. } // end function operator!=
  14.  
  15. // subscript operator for non-const objects returns modifiable lvalue
  16. int &operator[]( int );
  17.  
  18. // subscript operator for const objects returns rvalue
  19. int operator[]( int ) const;
  20. private:
  21. int size, m,n; // pointer-based array size
  22. int a[10][10]; // pointer to first element of pointer-based array
  23. }; // end class Array
To copy to clipboard, switch view to plain text mode 

My code so far
Qt Code:
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. #include "array.h"
  5.  
  6.  
  7. Array::Array( int m, int n )
  8. {
  9. size = ( m*n > 0 ? m*n : 10 ); // validate arraySize
  10. a[m][n] =*new int[size]; // create space for pointer-based array
  11.  
  12. for ( int i = 0; i < m ;i++ )
  13. for ( int j = 0; j <n; j++ )
  14. a[ i ][j] = 0; // set pointer-based array element
  15. }
  16.  
  17.  
  18. Array::~Array()
  19. {
  20. delete *[]a;
  21. }
  22.  
  23. Array::Array( const Array &arrayToCopy )
  24. : size( arrayToCopy.size )
  25. {
  26. a[m][n]= *new int[ size ];
  27.  
  28. for (int i = 0; i < n; i++ )
  29. for (int j = 0; i < m; j++ )
  30. a[ i ][j] = arrayToCopy.a[ i ][j];
  31.  
  32. }
  33.  
  34.  
  35.  
  36. int main()
  37. {
  38. Array mat1;
  39. Array mat2(4,5);
  40. }
To copy to clipboard, switch view to plain text mode 

When I run it, it runs ok . But if I implement the destructor , it crashes. I think my memory allocation for a is probably screwy too.. Helpl