I have a class which hold an array "float ** table
". Now I want to have member function to return it, but don't want it to be modified outside of the class. So I did this:
class sometable
{
public:
...
void updateTable(......);
float **getTable() const {return table;}
private:
...
float **table;
}
This compiles OK when I call getTable with a constant object. Now I tried to
make it safer by declaring getTable as "const float **getTable()
". I got
the following compilation error:
Error:
Cannot return float**const from a function that should return const float**.
Why? How can I avoid table to be modified out side of the class?