I have a default function like this:
fun <T> makeDefault(): Animal<T> = Animal<Nothing>(
name = "",
size = 0,
age = 0
)
I saw that there is the by
operator, which can be used for view models like this:
val model: MyViewModel by viewModels()
Question: How I can create a function that behaves like that for my makeDefault()
?
What I want to do:
val animal: Animal<Dog> by makeDefault()