You are viewing a single comment's thread. Return to all comments →
class Matrix { public: vector<vector<int>> a; Matrix operator+(const Matrix& other) { Matrix result; int n = a.size(); int m = a[0].size(); for (int i = 0; i < n; i++) { vector<int> row; for (int j = 0; j < m; j++) { row.push_back(a[i][j] + other.a[i][j]); } result.a.push_back(row); } return result; } };
Seems like cookies are disabled on this browser, please enable them to open this website
Operator Overloading
You are viewing a single comment's thread. Return to all comments →