Use operator instead of function

BlitzMax Forums/BlitzMax Programming/Use operator instead of function

Mathieu A(Posted 2005) [#1]
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?


Cajun17(Posted 2005) [#2]
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.


FlameDuck(Posted 2005) [#3]
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.