Mar 30, 2013 at 4:04pm
The reason of the error is statement
double* val[i] = new double [M];
in the constructor. I think you meant
val[i] = new double [M];
Also you incorrectly delete val in the destructor.
Mar 30, 2013 at 4:05pm
As a C++ programmer, you are encouraged to use initialization lists for constructors.
Try this (code wasn't tested):
1 2 3 4 5
|
sample::sample(): val(new double* [d]){
for (int i = 0; i<d; ++i){
val[i] = new double [M];
}
}
|
Last edited on Mar 30, 2013 at 4:06pm
Mar 30, 2013 at 4:09pm
Indeed, vlad. I saw that in the last moment.