Czar
06/21/2017, 11:33 AMdata class CommonProperties(/*properties here*/)
sealed class Device(val commonProperties: CommonProperties)
data class Type1Device(commonProperties: CommonProperties, /*other properties*/): Device(commonProperties)
//...
You probably see the problem: Data class primary constructor must have only property (val / var) parameters
. Any suggestions on how to improve the design of my hierarchy?spand
06/21/2017, 11:37 AMval commonProperties
on an interface ?lupajz
06/21/2017, 11:47 AMopen val
in sealed class header would not work ? or maybe just use class instead of dataCzar
06/21/2017, 11:57 AMCzar
06/21/2017, 12:03 PMspand
06/21/2017, 12:07 PMspand
06/21/2017, 12:13 PMDevice
?lupajz
06/21/2017, 12:13 PMCzar
06/21/2017, 12:14 PMCzar
06/21/2017, 12:15 PMdarkmoon_uk
06/21/2017, 12:44 PMcommonProperties
in the way you've done, just use inheritance and put the properties in Device
.