I was wondering how to go about this. I have a matrix object that is a 2d array that grabs a matrix. I am trying to build an add method to add my matrices together.I am a second semester student and have more methods but i am stuck on how to go about this. we have done up to overloading operators, dynamic memory and pointers. I just need some guidance to help me learn this stuff effectively instead of trying for 12 hours. Any help would be grateful.
my class function is
Matrix Matrix:: add(const Matrix & m) const
{
Matrix v; // I know to make a matrix to add
// I tried this but seems to not work
v=v[rows][cols]+ m[rows][cols];
return v
}
I think I have figured it out now. Thanks! But i will still vote best answer so have at it! It might be useful for other students.