- #1
vociferous
- 253
- 6
I have been pulling my hair out on this one.
I have a double** that is a private member of a class. The constructor declares and initializes it as a 2 dimensional dynamic array of doubles (an array of arrays). Then it sets every element of the array equal to 0 with a set of two nested for loops.
This seems to work fine.
However, whenever any of my accessor or mutator functions that are also members of the class try to use this array using the array[][] subscripts, I get an error. This seems to be because somehow the address of the pointer array gets "lost" after the constructor runs.
I have no idea why it would happen. Private pointer variables that are a member of a class should retain their values for all functions used by that instance of the class.
I have a double** that is a private member of a class. The constructor declares and initializes it as a 2 dimensional dynamic array of doubles (an array of arrays). Then it sets every element of the array equal to 0 with a set of two nested for loops.
This seems to work fine.
However, whenever any of my accessor or mutator functions that are also members of the class try to use this array using the array[][] subscripts, I get an error. This seems to be because somehow the address of the pointer array gets "lost" after the constructor runs.
I have no idea why it would happen. Private pointer variables that are a member of a class should retain their values for all functions used by that instance of the class.