So i have a matrix that is [2][2], and i want to be able to have:
[cody]
Matrix a(1, 2, 3, 4); //a = [2][2] - 1, 2, 3, 4
Matrix b(4, 3, 2, 1; //b = [2][2] - 4, 3, 2, 1
Matrix c;
c = a + b;
[/code]
I have (summed up):
Code:
class Matrix
{
public:
Matrix();
Matrix(double a, double b, double c, double d);
Matrix operator + (Matrix first);
private:
//the matrix, etc
};
Matrix::Matrix operator + (Matrix& a)
{
}
I don't know how to implement it, no tutorial i can find explains it well enough to me. I don't see how i can only pass one object and what to return....
What it needs to do is:
Code:
| 1 2 | | 4 3 | | 5 5 |
+ =
| 3 4 | |2 1| |5 5 |
Can anyone help me out quick? Thanks.