I am making a javaFX class and I need one of the variables to be initialized in order for it to work (in my program there's no default value I can use). This is the best I've come up with, but I'd like something that wont compile unless you initialize the variable.
Example Class:
Public class Class1{
public-init var var1:String;
postinit{
if(var1 == null){
println("You need to initialize var1");
}
}
I'd call it like this:
var object1 = Class1{var1:"input"};
How can I prevent it from compiling if I do this?
var object1 = Class1{};