Hi
I have written a class with the name of Matrix which should work like sum,.. on matrixes,and becouse it's type is not clear i have used 2 template(one for the type of my matrix,and one for which should be summed to mine) but it sais to me that your decleration is not match to my definition,i don't know why?
here it is:
Code:
in matrix.h:
class Matrixes
{
private:
matrix_type mat[10][10];
int row,column;
public:
template<class T>
Matrixes sum(Matrixes<T>);
};
in matrix.cpp:
template<class matrix_type,class T>
Matrixes Matrixes<matrix_type>::sum(Matrixes<T>mat2())
{
Matrixes<T> result(row,column);
if(mat2.get_column()!=get_column() || mat2.get_row()!=get_row())
cout<<"They can not be added together"<<endl;
else
for(int i=0;i<row;i++)
for(int j=0;j<column;j++)
result.get_mat()[i][j]=static_cast<T>((mat2.get_mat()[i][j]+mat[i][j]));
return result;
}