package drills.drill06.exercise4.actuator interface Action { enum class State { ON, OFF } fun getActionName(): String fun getState(): State fun on() fun off() } abstract class VirtualAction : Action { private var state = Action.State.OFF override fun getState(): Action.State = state override fun off() { println("Switching off: ${getActionName()}") state = Action.State.OFF } override fun on() { println("Switching on: ${getActionName()}") state = Action.State.ON } }