operator+

martin (schulte@pktw09.phy.tu-dresden.de)
Tue, 13 Jul 1999 18:12:22 +0200


dear rooters,
i made a simple vector class which i implemented in root via rootcint.
everithing wokes fine exept that i can't define (override) any
operators.
example:

in V3D.h :
friend V3D operator+(const V3D &v ,const V3D &w);

in V3D.C :
V3D operator + (const V3D &v, const V3D &w)
{ V3D r=V3D(v.GetX()+w.GetX(), v.GetY()+w.GetY(), v.GetZ()+w.GetZ());
return r;
}

when i now do:
V3D peter;
const V3D paul(1,2,3);
const V3D nmary(10,10,10);
everithing is ok, but :

peter = paul + nmary;
Error: operator+ not defined for V3D
FILE:/data_fck/schulte/root/Rummspiel/Linking/./test+.C LINE:6
*** Interpreter error recovered ***

what seems strange, is that compilation an linking works whithout
errors. all other defined funktions work well.

so, is it a bug or do i do something stupid?

thank you.