copying objects and overwriting = operator

could someone make an example which doesnt require passing each variable…

void operator=( const ofPoint& vec ){
x = vec.x;
y = vec.y;
}

i have too many variables to do something such as that conveniently
so i tried doing the same but making a new object

void operator=( const Obj& obj ){
this = new Obj();
}

is this possible? i tried and it failed…

Hey - the best solution would be to use memcpy which would make a perfect copy of the object you want to set it equal to.

I think you could do this.

  
void operator=( const ofxPoint2f& vec ){   
	memcpy(this, &vec, sizeof(ofxPoint2f));  
}   

Hope the helps!
Theo