Paul Woitaschek
01/07/2020, 7:20 PMinterface MySomething{
fun hello()
}
val a = object : MySomething{
override fun hello() {
GlobalScope.launch {
doSomethingWithMySomething(this) <<--
}
}
}
fun doSomethingWithMySomething(something : MySomething){
}nwh
01/07/2020, 7:21 PMthis@object, eg this@MySomethingPaul Woitaschek
01/07/2020, 7:21 PMnwh [8:21 PM]
UseThat doesn't work, egthis@objectthis@MySomething
Paul Woitaschek
01/07/2020, 7:23 PMval me = this as the first statement of the hello bodyDico
01/07/2020, 7:24 PMthis@functionName - receiver
this@declaringClassName - instancePaul Woitaschek
01/07/2020, 7:24 PMnwh
01/07/2020, 7:24 PMDico
01/07/2020, 7:24 PMDico
01/07/2020, 7:25 PMprivate fun me() = this and call itPaul Woitaschek
01/07/2020, 7:26 PMDico
01/07/2020, 7:26 PMrobstoll
01/07/2020, 9:58 PMobject a : MySomething {
override fun hello() {
launch {
doSomethingWithMySomething(a)
}
}
}