Let there be a class :
template <class A_Type,int sizeA,int sizeB>
class Matrix {
A_Type myMatrix[sizeA][sizeB];
int sizeA_Val;
int sizeB_Val;
public:
Matrix();
Matrix(A_Type val);
int getSizeA()const{return sizeA_Val;} ;
int getSizeB()const{return sizeB_Val;};
A_Type mini() const;
double avg() const;
Matrix operator+(const Matrix& b)
{
Matrix<A_Type,sizeA,sizeB> tmpNew;
for (int i=0;i<sizeA;i++){
for (intj=0;j<sizeB;j++){
tmpNew[i][j]=myMatrix[i][j]+b[i][j];
}
}
return box;
}
};
it is working exept to the Matrix operator+(const Matrix& b)
function
i want it to work co i want to create operator [][], is it possible?
i want for example if i see mat[i][j] it will return the value in the mat->myMatrix[i][j]
is it possible?