Correct the code below to make the program work properly.
Computer scienceProgramming languagesKotlinObject-oriented programmingObject-oriented programming basic
Overriding constructors
Making a flowerbed
Report a typo
Sample Input 1:
red roseSample Output 1:
This flowerbed has many red rosesWrite a program in Kotlin
open class Plant(val name: String)
class Flower(val color: String) : Plant
class Flowerbed (val color: String, name: String) : Flower() {
fun print(){
println("This flowerbed has many $color ${name}s")
}
}
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.