i have a 2D array of ints. its a private member of my class and i want to keep it that way
the name of a 2D array is nothing more than a pointer to the first element of an array, which is in turn a pointer to the first element in its array.Code:class Class { private: int array[10][10]; //... };
array is a pointer to array[0] which is a pointer to array[0][0].
so i make a function that returns a 2D pointer.
but i always end up with an error like this:Code:int ** Class::function() { return array; }
" cannot convert int[10][10] to int ** "
now, if a 2D array is just a double pointer, why wont this work? how can i get to this outside of the class without making it public?