You should be able to return a pointer to an array in a class. Let me work on it for few minutes.
Not very pretty:
--Code:#include <iostream> typedef int myarray[5][5]; class myclass { myarray arr; public: myclass() { for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) arr[j][i] = i * j; } } friend std::ostream &operator<<(std::ostream &os, const myclass &c); myarray * getArray() { return &arr; } }; std::ostream &operator<<(std::ostream &os, const myclass &c) { for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) os << c.arr[j][i] << " "; os << std::endl; } return os; } int main() { myclass c; int (*p)[5][5]; std::cout << c; p = c.getArray(); for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) std::cout << (*p)[j][i] << " "; std::cout << std::endl; } return 0; }
Mats