Reputation: 41823
I have a trait that defines a single var and a single function like what follows:
trait MyTrait {
var myVar: Boolean
def myFunction = 7
}
This trait is used by a class (let's say MyClass) and I'm using that class in a couple of Java files that I haven't converted yet. How, in my existing Java classes, can I access that variable? I can access the method just fine.
Upvotes: 0
Views: 88
Reputation: 41823
Figured it out in one last attempt. If you initialize myVar
it works as expected.
var myVar: Boolean = _
Upvotes: 1