Constant Size Array in Class Init [message #76238] |
Mon, 23 May 2011 14:27 |
Chris Williams
Messages: 4 Registered: May 2011
|
Junior Member |
|
|
I am creating a class that holds multidimensional data of several
different arrays.What I am trying to do is create a class to hold the
arrays, and then define the array sizes in the init function since
they will be different sizes.
For example, I want to do something like this
FUNCTION myclass:init, dim1, dim2, dim3
myarray = dblarr(dim1, dim2, dim3)
RETURN,1
END
PRO myclass__define
void = {myclass, myarray :dblarr } ;NO SIZE ON ARRAY
RETURN
END
However, I get a conflicting data structure error without first
defining the size of the array in the procedure myclass__define. Is
there an empty array object that allows me to define the array size at
initialization and not at object creation?
Another example in JAVA,
//Class definition
class myClass(){
double myarray[][][];
//Constructor
myClass(dim1, dim2, dim3){
myarray = new double[dim1][dim2]dim3];
}
}
|
|
|