Topic: How to dynamically create 2-d array of Objects??? // How to use them ?


Author: zrzm0370@helpdesk.rus.uni-stuttgart.de (Joerg Scheurich)
Date: 3 May 1993 14:40:20 GMT
Raw View
In article <1ru11gINN8t6@mephisto.gatech.edu> andy@cerl.gatech.edu (Andy Register) writes:

>Here is some code from a 2-D Matrix template I have coded.  The
>class is called GTMatrixRep and I have included the default ctor
>and the dtor.  You can look at this code to figure out how to
>construct a 2-D array and how to destroy it.

Sorry if this is a FAQ (I didn't find it...), but how can be such a array
used with overloded operator[] ?

Is this possible ?

class matrix
{
// .....


//or something like this ....

double *feld;


// ....

// ?????

// how would this missing code look like ?

}

main()
{
matrix test(5,5);

// access the 3. row and the 2. colum (or reverse) with overloaded operator[]

test[3][2]=4;
cout << test[3][2];
}

so long
MUFTI