Skip to content

Instantly share code, notes, and snippets.

@StylingAndroid
Last active April 19, 2019 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StylingAndroid/eca8952c9568a5d415e19040c6907cf1 to your computer and use it in GitHub Desktop.
Save StylingAndroid/eca8952c9568a5d415e19040c6907cf1 to your computer and use it in GitHub Desktop.
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