Path: utzoo!attcan!uunet!fernwood!hercules!apple!usc!cs.utexas.edu!ut-emx!walt.cc.utexas.edu!ycy From: ycy@walt.cc.utexas.edu (Joseph Yip) Newsgroups: comp.lang.c++ Subject: operator[] for 2D array class Message-ID: <21162@ut-emx.UUCP> Date: 19 Nov 89 08:12:53 GMT Sender: news@ut-emx.UUCP Reply-To: ycy@walt.cc.utexas.edu (Joseph Yip) Organization: The University of Texas at Austin, Austin, Texas Lines: 23 I am working on some routines that manipulate 2D array. In order to access individual elements, I define a operator [] member function. However, operator [] only takes one parameter. In order to do A[i][j] = B[i][j] // A and B are two 2D array classes I do: Tmp Array2D::operator [] (int i) { ... } int& Tmp::operator[] (int j) { ... } In this way, the problem is solved. Is there any better way to do this object array indexing? Thanks Joseph