You are viewing a single comment's thread. Return to all comments →
Hello i want to share my solution, enjoy:
class Matrix { public: vector<vector<int>> a; Matrix operator+(const Matrix& b) { Matrix m; m.a.resize(b.a.size()); for (int i = 0; i < a.size(); i++) { m.a[i].resize(b.a[i].size()); } for (int i = 0; i < b.a.size(); i++) { for (int j = 0; j < b.a[i].size(); j++) { m.a[i][j] = a[i][j] + b.a[i][j]; } } return m; } };
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 →
Hello i want to share my solution, enjoy: