Computer scienceProgramming languagesKotlinObject-oriented programmingClass hierarchy

Overriding properties

In the animal world

Report a typo

Create an Animal base class with a public sound property set to "unknown". Then add a subclass Dog and override the sound property to "woof".

Write a program in Kotlin
class Animal {
// make your code here
}

class Dog : Animal() {
// make your code here
}
___

Create a free account to access the full topic