I'm trying to do a little variation of the Interface delegation example come in the official Kotlin bootcamp in => developer.android.com but I'm getting unexpected results. Please can anybody provide some hint on what's happening?:
interface IFishAction {
fun swim();
}
interface IFishColour {
val color: String;
}
interface IFeeding{
fun eat( );
}
object carnivorous: IFeeding{
override fun eat() {
println("Meat!")
}
}
class Shark( carnivorous: IFeeding ): IFishAction, IFishColour, IFeeding by carnivorous {
override val color = "gray"
override fun swim() {
println("swim quickly")
}
}
fun main) {
val shark = Shark( carnivorous )
println("---------------------------");
println("Shark color: ${shark.color}");
println("Shark swim: ${shark.swim()}");
}
=>
---------------------------
Shark color: gray
swim quickly
Shark swim: kotlin.Unit