Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fun main() {
val classOne = ClassOne()
val classTwo = ClassTwo()
classTwo.myFunc(true, classOne::doSomething)
}
class ClassOne {
private val output = "Hello, world!!!"
fun doSomething() {
println(output)
}
}
class ClassTwo {
fun myFunc(someCondition: Boolean, funcRef: () -> Unit) {
if (someCondition) {
funcRef()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment