Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Matrix operator = (Matrix m1)
- {
- int c, l;
- c = m1.getCols();
- l = m1.getRows();
- cout << l << " " << c;
- //this->n_rows = m1.getRows();
- // cout << "yau";
- //this->n_cols = m1.getCols();
- Matrix result(l, c);
- if (this->ptr != m1.ptr)
- {
- for (int i = 0; i < l; i++)
- for (int j = 0; j < c; j++)
- {
- result.ptr[i][j] = m1.ptr[i][j];
- //cout << result.ptr[i][j];
- }
- for (int i = 0; i < this->n_rows; i++)
- delete (this->ptr[i]);
- delete (this->ptr);
- this->n_rows = l;
- this->n_cols = c;
- this->ptr = result.ptr;
- for (int i = 0; i < l; i++)
- for (int j = 0; j < c; j++)
- {
- cout << this->ptr[i][j] << " ";
- }
- return *this;
- }
- else
- return m1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement