Thank you for your reply.
Yes, I mean a Dense and Sparse matices.
The code I have given is a sample of what I need to do.
What is actually done is I have a template class called Matrix<T> and derived from it Sparse<T> and Dense<T>.
The idea here is for example the Sparse<T> could have entries as double for example, Sparse<double>. However, what I want to do is that the matrix sparse can also contain another matrices.
Which in this case means that A is sparse matrix that contains in it pointers to dense matrices.
Then I want to go one step further. I want matrix Sparse can contain any type of matrices.
Which means that A is sparse and its elements are pointers to an any kind of a matrix.
Now, the issue is when I need to add the entry at A(1,1) to another the entry of Matrix B(1,1). in other words.
However, since matrix A can contain any type of matrix, in other way, it contains pointers to Base class, then I must define the operator + for the base class as well, otherwise the compiler complains saying that class Mbase has no operator +.
And when I define operator + in Mbase
Mbase operator +(Mbase A);
The compiler again complains that cannot return MBase because it is abstract type.
So how can I define the operator for the MBase class.
I hope I was able to describe what I want.