Hi Gareth,
Try this...
class Blah {
public:
double x,y,z;
double& operator [] (int i) { return (&x)[i]; }
};
Note: this is relying on the C++ behavior of laying out in memory the
variables as given. This is a typical (standard?) behavior of all the C++
compilers that I've used.
--Eljay