I'ld like to manually set the value of a 2D array that is a class member. Largely because I already fill it up with loops in a different method but in a different method I want to fill it by hand.
class SomeClass {
private:
int** myArray;
public:
void setMyArray(int /*h*/,int /*w*/);
}
void SomeClass::setMyArray() {
// Something like this:
this->myArray** = { {1,2,3},{3,2,1},{4,5,6}};
}
Failing that, is there a way to generate its dimensions and then fill manually?
void SomeClass::setMyArray( int height, int width ) {
// Something like this:
this->myArray** = new*int[height];
for ( 0...height, i ) {
this->myArray[i] = new[width];
}
myArray** = {{1,2,3},{1,2,3},{1,2,3}};
}