class Matrix1
{
Protected:
int ** data;
int row,col;
Public:
};
Class Matrix2 : Public Matrix
{
Public:
Matrix2()
{
}
Matrix2 (int a, int b):Matrix1(a,b)
{
}
void resize()
{
//?????
}
};
// can we do this in our driver/main file(function) i.e.
Matrix1 m1(3,4);
Matrix2 m2(3,4);
Matrix2 m=m1+m2;
in the above statement on the right hand side i.e. m1+m2 ... m1 is of Matrix1 type due to which it will call its +operator and add object m2 in it and return an object of type Matrix1 ... and on the left side of this statement it is Matrix2 ... is this assignment possible , if no then how can i do this ! i am confused !
It will Add two matrix objects , simply you can say that add two matrices and return resultant matrix ... ! But my question was is it possible ? because resultant matrix is of Matrix1 type .