I'm writing a graphics program that uses 3D vectors, I have an existing library that I've written that already contains all the code for vector manipiulation but it was written in C using a struct to define a vector and funtions to manipulate them.
I now have a Vector class as I'm writing in C++ and rather than have to call a funtion which makes the code less readable I'd like to overload the operators, the only problem is I dont know how to write the function headers for the operator overloading for what I need or if its possable for some of it. this is whats needed
Vector + Vector = Vector
Vector - Vector = Vector
Vector x Vector = Vector (Cross product)
Vector . Vector = float (Dot product)
Vector * float = Vector (Scaling)
Vector = Vector
also if I'm using pointers to the vector class would I need to dereference the pointer to use the operators?
I'm not to sure how operator over loading works but would a line like this
be processed asCode:CVector operator + (CVector &v2)
Code:return type = this + v2