Skip to content

Instantly share code, notes, and snippets.

@digitalbuddha
Created April 21, 2020 18:53
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 digitalbuddha/49056674f44e9f7b926ee0243f7cb4e5 to your computer and use it in GitHub Desktop.
Save digitalbuddha/49056674f44e9f7b926ee0243f7cb4e5 to your computer and use it in GitHub Desktop.
interface Foo{
fun doStuff()
companion object
}
fun Foo.Companion.CreateFoo():Foo = RealFoo()
private class RealFoo : Foo{
override fun doStuff() {
"Doing Stuff"
}
}
//Somewhere else in your application
Foo.CreateFoo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment