``` private fun Boolean.toByte(): Byte = if (this)...
# announcements
r
Copy code
private 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()))
}