lesincs
09/13/2021, 12:27 PMFoo
class, I can write an internal extension function for String
, and I can use this extension function only in the Foo
scope.
class Foo {
fun String.greet(): String {
return "Hello$this"
}
}
fun main() {
with(Foo()) {
"str".greet()
}
}
But what if the Foo
class is in some library, how do I achieve the same functionality?Javier
09/13/2021, 12:45 PMlesincs
09/13/2021, 12:51 PMCLOVIS
09/16/2021, 5:08 PM