Adding/Subtracting Types
BlitzMax Forums/BlitzMax Programming/Adding/Subtracting Types
| ||
Something I miss from C++. Being able to just add and subtract, multiply, divide etc a class by another class. But in BlitzMax I have to do that for each parameter. So instead of:Method Divide:TVector2(Vector:TVector2, Vector2:TVector2) Return Vector - Vector2 End Method I have to do: Method Divide:TVector2(Vector:TVector2, Vector2:TVector2) Temp:TVector2 = new TVector2 Temp.X = Vector.X / Vector2.X Temp.Y = Vector.Y / Vector2.Y Return Temp End Method Is this the only way to do it or is there some secluded secret method of doing such a task? |
| ||
No there is no overloading of functions or operators, so this is the only way to do it. Although you have an "error" or unneeded part there: Method Divide:TVector2(Vector2:TVector2) Temp:TVector2 = new TVector2 Temp.X = Self.X / Vector2.X Temp.Y = Self.Y / Vector2.Y Return Temp End Method |
| ||
Damn that sucks, Its not a big problem but it would be nice to have such an implementation. |
| ||
It already happens with adding String objects together. This shouldn't have any of the ambiguity problems that function overloading would have as far as I can see, I'd like to see this too. |