Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!agate!saturn!skinner From: skinner@saturn.ucsc.edu (Robert Skinner) Newsgroups: comp.lang.c++ Subject: matrix types and [] overloading Keywords: matrix, [] overloading Message-ID: <5181@saturn.ucsc.edu> Date: 19 Oct 88 17:07:37 GMT Organization: U.C. Santa Cruz, CIS/CE. Lines: 18 (I know that this subject was discussed a few weeks ago, but I didn't pay much attention then. Now I need to know. Sorry for the repetition.) I'm constructing a general 2d Matrix object for a class I'm now taking on matrix computations. It would be nice if I could overload the [] operator to allow something like a[1][2], but I understand that is not possible. Another option is to overload the () operator to provide array indexing: virtual float *operator()( int i, int j ) { return data + i*cols + j; } This works, but it proliferates lots of *'s in the code, making it less readable. Is there something I'm missing that was explained by a previous poster? Or is this the best that can be done right now. Robert Skinner skinner@saturn.ucsc.edu