So now, we can add new functions even for the class that is in the third-party library. Such a function is called an “Extension function” and we can use such an extension function only inside the class where it is created. In kotlin, we can add a new function for any class in any other class too. We write more methods in the same class.īut, if the class is in the third-party library that we are using through dependency or in such a way that we cannot add new functions in such a class, we cannot modify that class. Later, we realize that we need more methods for the class. Kotlin: Function type, function literal, lambda expression and anonymous function
0 Comments
Leave a Reply. |