February 2019
Intermediate to advanced
442 pages
11h 46m
English
If you need to extend a class with a set of new functionalities, you need to update the Java source code. However, if you are using third-party libraries, you may not have the source. A class needs to be extended to accommodate other functions. You also can use various design patterns such as decorator and strategy for this purpose.
However, Kotlin allows the straightforward adding of extra functions to an existing class with the feature called an extension function. As its name implies, an extension function extends the functionality of the class without touching its source code. In other words, you are no longer required to inherit the class to be extended. This sounds really interesting. It behaves just like other member ...