hello
I have a problem and it is something like this .
I have 5 static arrays in one class called S1 ,S2 ....S5(all 2 D arrays).
Now , I want to access some number of elements in each one of the arrays .
But i don't want to explicitly specify the names of all the arrays ,
say S1[k][j] or S2[k][j] in order to do a similar look up .
What are the design ways in which I can get this done. ??
One possibility was that I could call a function with an argument like,
int foo(int row,int col ,int n){
switch(n)
{
case 1: return S1[row][col];break;
case 2: return S2[row][col];break;
...
}
}
another way is to make it a 3 D array ......
All this is for doing a table lookup ..can someone please suggest a better
way to do this , maybe using some design technique (say something with
function objects etc....??)
Thanking you,
Maadhuu.