Animal sounds

Report a typo

Create an anonymous object that inherits the Animal class.

Redefine the makeSound() method so that it displays a word corresponding to the sound produced by the animal (for example, "Meow" for a cat) to the console.

Write a program in Kotlin
open class Animal {
open fun makeSound() {
println("Animal sound")
}
}

val animal = // make your code here
}
___

Create a free account to access the full topic