Kotlin Class Inheritance Basics: the 'open' keyword


Example

In Kotlin, classes are final by default which means they cannot be inherited from.

To allow inheritance on a class, use the open keyword.

open class Thing {
    // I can now be extended!
}

Note: abstract classes, sealed classes and interfaces will be open by default.