Actually I have a question about two dimensional arrays in C++. The first question is how the Compiler interprets the two dimensional array with difference to a "normal" one dimensional array. Then I need to implement a operator overload for two dimensional arrays.
This is the overloaded operator for normal array:
const float& Matrix::operator[] (int index) const
{
const float& value = this->m[index];
return value;
}
This is the overloaded operator for two dimensional array:
const float& Matrix::operator[][](int index, int ndIndex) const
{
const float& value = this->m[index][ndIndex];
return value;
}
Is this the theorethical correct implementation for a [][] operator overload?
Then there is a question why it's difficult to get write access to the array in the [][] solution. The last question is that this problem can be solved with a Proxy pattern, but I never heard Proxy as a programm pattern.
All these questions are theoretical so I dont need real code, just the context "behind the scene" and a scetch about the proxy pattern.
Would nice if you could help me out! Thanks in advance!!