Use operator instead of function
BlitzMax Forums/BlitzMax Programming/Use operator instead of function
| ||
Hi, I'm writting mathematical functions. And I have functions like addition, substraction into my MATRIX type. I'd like to know if it's possible to use operator like (* + / ) instead of method like Add(), Multiply() etc. For example in C++ we can use these operator like that: Vector3D operator- () const { return Vector3D(-x,-y,-z); } Is that possible to do that in BMAX? |
| ||
No, as of right now there's no way to do operator overloading. I don't think it's planned for the future and if it is a planned feature it probably has a low priority. |
| ||
No, as of right now there's no way to do operator overloading. While technically true, strings are objects, and do have an overloaded operator ("+" for concatenation). This might however simply be hardcoded into the compiler / pre-processor. |