August 2017
Intermediate to advanced
440 pages
10h
English
As we already know, a supertype of all Kotlin types is Any. It is the equivalent of the Java Object type. Each Kotlin class explicitly or implicitly extends the Any class. If we do not specify the parent class, Any will be implicitly set as the parent of the class:
class Plant // Implicitly extends Any
class Plant : Any // Explicitly extends Any
Kotlin, like Java, promotes single inheritance, so a class can have only one parent class, but it can implement multiple interfaces.
In contrast to Java, every class and every method in Kotlin is final by default. This conforms to the Item 17 in Effective Java, the Design and document for inheritance or else prohibit it rule. This is used to prevent unexpected behavior from a subclass ...
Read now
Unlock full access