poohbar
11/01/2017, 3:36 PMclass Person(override val id: String, val name: String) : HasId
and this Java interface:
public interface HasId {
String getId();
}
How do I implement the interface? The above example gives me 'id' overrides nothing
diesieben07
11/01/2017, 3:46 PMid
val as private and implement getId
using a fun
. You will still be able to use the object.id
syntax when accessing the field.karelpeeters
11/01/2017, 4:54 PM