Created
June 17, 2021 06:54
-
-
Save CheolhoJeon/f0eff9beb20ece559617ab08792e10f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package chap5.CompanionObjects | |
import atomictest.eq | |
interface Extended: ZI { | |
fun u(): String | |
} | |
class Extend : ZI by Companion, Extended { | |
companion object: ZI { | |
override fun f() = "Extend.f()" | |
override fun g() = "Extend.g()" | |
} | |
override fun u() = "${f()} ${g()}" | |
} | |
private fun test(e: Extended): String { | |
e.f() | |
e.g() | |
return e.u() | |
} | |
fun main() { | |
test(Extend()) eq "Extend.f() Extend.g()" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment