https://kotlinlang.org logo
Title
c

cfleming

05/08/2018, 12:25 AM
So from:
public interface MyInterface {
  String getText();
}
I can’t seem to use:
class MyClass(val text: String): MyInterface
c

Czar

05/08/2018, 12:35 AM
You can't, unfortunately. You will have to do
class MyImplementation(internal val text: String) : MyInterface {
	override fun getText() = text
}
using
internal
instead of private allows you to use
.text
with its instances when called from the same module from kotlin, if you kept it
private
you would have to use
.getText()
even from Kotlin.
c

cfleming

05/08/2018, 1:41 AM
Ok, thanks Alexander!