Actions

Kotlin

From zen2

Revision as of 01:03, 18 November 2017 by Chris (talk | contribs)

Class

By default Kotlin classes are final, meaning no classes can inherit from them. In order to make them not final declare them open

open class Vehicle() {}

To override class functions they must also be declared open

open class Vehicle() {
    open fun drive() {} 
}

class Car() : Vehicle() {
    override fun drive() {
    }
}