====== 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: [[https://manual.grogra.de/de.grogra.xl/ch11s02.html#s-operator-methods|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) { public static A operator+ (A a, int b) { a.len += b; return a; } public void operator++(){ ++this.len; } } public void run () { A a1 = new A(); println( ~a1 ); // print true println( a1 + 1 ); // print a1 with a slightly bigger len ++a1; // increases a1.len by 1 } A list with all object that currently use overloaded operators can be found [[01_user_documentation:07_rgg_xl:02_xl:10_rgg_addition:04_operator_overload| here]]