01_user_documentation:07_rgg_xl:02_xl:09_java_addition:overload_operator
Overload operator
Operators can be overloaded in XL by declaring the method operator$NAME_OF_OPERATOR(var , var ){}.
The list of operators in groimp is available at: xl specification.
module A(float len) extends Sphere(0.1) { public static boolean operator$com (A a) { return true; } public static A operator$add (A a, int b) { a.len += b; return a; } } public void run () { A a1 = new A(); println( ~a1 ); // print true println( a1 + 1 ); // print a1 with a slightly bigger len }
01_user_documentation/07_rgg_xl/02_xl/09_java_addition/overload_operator.txt · Last modified: 2025/08/20 10:32 by gaetan
