I want to implement Vector and Matrix classes in C++, such that Vector and Matrix objects are able to be multiplied. There are the following 2 structures that I could think of for their implementations:
Implement the template class
VectorwithT*type of data, and then define template classMatrixas an array ofVectors.Implement the template class
MatrixwithT**type of data, and then inherit template classVectoras aMatrixwith (number of columns = 1).
The disadvantage of the 1st approach is that, Vector class doesn't take care of column and row vectors and the vector-vector multiplications would be problematic, and in second approach, the Vector would be treated as a 2D Matrix with (number of columns =1) or T**.
What would be the best way to implement these 2 classes? Thanks.