Hello,
i've been searching for any hints for my problem for two days. I've noticed some usefull ones, but unfortunately i still don't get it.
The problem seems to be very simple:
i've got program which calculates matrices. Firstly, i create object A which is class Matrix and load from file values to fill the matrix. Then i need to call to element pointed by indexes i and j, that is A[i][j] and then change some values in the matrix A.
What my problem is? Well, i've implemented my program in following way:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
class Matrix
{
private:
struct RCMatrix;
RCMatrix* matrix;
public:
...
};
struct Matrix::RCMatrix
{
double* data;
int rows,columns;
int reffCounter;
...
};
|
(i'm using 1D array (storing data from one row right after stored data from previous row), actually, but i need to call to it using doubled operator [][])
and now i know (actually, I think i know, but i'm not sure ;) ), that i need to create a class (let's call it Row), overload the operator [] for the first time in that class and after that i need to return overloaded value to another overload operator [] and somehow i will get to values i need.
I think, that it looks like that in theory. But i've got some troubles with its implementation. In simple words: I don't know how to write this class row :)
Is that struct RCMatrix a good idea? Or should i create class instead of it and then (in that class) nest class Row? eh, don't know how to do it in a way which i will simple understand...
Could anybody help?
I'm rather not smart person so be patient, please:)