User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:09_java_addition:implicit_conversion:01_constructor

Constructor

A class, or module can declare a constructor with the annotation @ConversionConstructor. That constructor will be used by default if the object is created from an object from the arguments of that constructor.

module B;
class A {
	@ConversionConstructor
	A(B value) { 
	//  init the object? Field can be set here
	}
 
	@ConversionConstructor
	A(int value) {
	//  init the object? Field can be set here
	}
}
 
public void run ()
{
	A t = new B();
	A t2 = 15;
	t2 = t;
	t = 3;
}
01_user_documentation/07_rgg_xl/02_xl/09_java_addition/implicit_conversion/01_constructor.txt · Last modified: 2025/08/20 10:32 by gaetan