Now try to construct a few characters!

Report a typo

You are given several interfaces and a few objects that implement them – basically, building blocks for composition-oriented class creation.

Your goal is to create/complete two classes: HighLevelledAlliedCleric and LowLevelledHostileBarbarian. You can probably guess from the name which objects you're supposed to use; now, what's left is to use them!

Write a program in Kotlin
interface Level {
fun getLevel(): Int
}

interface Enemy {
fun isEnemy(): Boolean
}

interface Class {
fun getClass(): String
}

object HighLevelled : Level {
override fun getLevel(): Int = 25
}

object LowLevelled : Level {
override fun getLevel(): Int = 3
}

object Hostile : Enemy {
override fun isEnemy(): Boolean = true
}

object Ally : Enemy {
override fun isEnemy(): Boolean = false
}

object Cleric : Class {
override fun getClass(): String = "Cleric"
}

object Barbarian : Class {
override fun getClass(): String = "Barbarian"
}

___

Create a free account to access the full topic