howie_
11 years agoContributor
JScript operator overloading
Hey everyone,
Does anyone know if it's possible to overload an operator in JScript?
Here's what I'm doing:
-------------------------------
Results.Pass += (test that returns 1 or 0);
Results.Total ++;
Here's what I'd like to be doing:
--------------------------------------------
Results += (test that returns bool or 1||0 );
and then overload the "+=" operator in the Results class to do the addition/incrementing for me.
I can't seem to find any information on this. I found something about C#Script supporting operator overloading, but it didn't say if JScript supported it or how to do it. Any help would be appreciated.
Thanks,
Howie
Does anyone know if it's possible to overload an operator in JScript?
Here's what I'm doing:
-------------------------------
Results.Pass += (test that returns 1 or 0);
Results.Total ++;
Here's what I'd like to be doing:
--------------------------------------------
Results += (test that returns bool or 1||0 );
and then overload the "+=" operator in the Results class to do the addition/incrementing for me.
I can't seem to find any information on this. I found something about C#Script supporting operator overloading, but it didn't say if JScript supported it or how to do it. Any help would be appreciated.
Thanks,
Howie