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/369b915e3a049a34e1bf1577df4eb802 to your computer and use it in GitHub Desktop.
Save digitalbuddha/369b915e3a049a34e1bf1577df4eb802 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