I'm trying to figure out how to add two classes together with a simple arithmetic addition
The class i've written is a Vector3 class it looks like this
public class Vector3 {
public float x, y, z;
public Vector3(){
x = 0.0f;
y = 0.0f;
z = 0.0f;
}
public Vector3(float _x, float _y, float _z){
this.x = _x;
this.y = _y;
this.z = _z;
}
public Vector3 add(Vector3 other){
Vector3 temp = new Vector3(this.x+other.x, this.y+other.y, this.z+other.z);
return temp;
}
}
I have added the add method in order to be able to add vectors together temporarily. but i really want to be able to just type vectorA+vectorB instead of having to type vectorA.add(vectorB)
is there a way to do this. i know you can do it in python.