I've made a vector class which contain the x, y, and z coordinates. The thing is i wanted to compare 2 vectors. This is my vector class

- So i've been able to give the vector's x, y, z values using operator. But then when i put this compare operator in:Code:class vect3 { public: double x, y, z; vect3() { x=0; y=0; z=0; } vect3(double xc, double yc, double zc) { x = xc; y = yc; z = zc; } vect3& operator=(vect3 &v) { x = v.x; y = v.y; z = v.z; return *this; }

Run the operator...Code://compare vector vect3& operator ==(vect3 v) { if(( x == v.x) && ( y == v.y) && ( z == v.z)) return v; } vect3& operator <=(vect3 &v) { if(( x <= v.x)&& ( y <= v.y)&& ( z <= v.z)) return v; } vect3& operator >=(vect3 &v) { if((x >= v.x) && (y >= v.y) && (z >= v.z)) return v; }

and get this errorCode:vect3 v1, v2; if(v1 == v2) // statement is true;

So can anyone help me and point out what the problem is. ThanksCode:error C2451: conditional expression of type 'class vect3' is illegal No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called