Ruckus
04/11/2018, 7:02 PMprivate fun Boolean.toByte(): Byte = if (this) 1 else 0
class Example internal constructor(data: ByteArray)
abstract class ExampleFactory(private val deviceId: Byte) {
open fun factory1(): Example = Example(byteArrayOf(0))
open fun factory2(on: Boolean): Example = Example(byteArrayOf(0, on.toByte()))
}
class Factory1 : ExampleFactory(0x65) {
override fun factory1(): Example = Example(byteArrayOf(65))
fun factory9(killer: Boolean): Example = Example(byteArrayOf(65, killer.toByte()))
}