Inheritance
Classes are final by default. Mark them open to extend and override functions with override.
Example
open class Animal { open fun sound() = "..." }
class Cat : Animal() { override fun sound() = "meow" }
val a: Animal = Cat()
println(a.sound())Exercise
Allow extending.
class AnimalQuiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.