1
I have an interface called UserManager who owns a var of the kind User
interface UserManager {
var user:User
/* ... */
}
and a class called UserManagerImpl implementing UserManager
class UserManagerImpl : UserManager {
override var user: User // = uma instancia default de User deve ser fornecida
/* ... */
}
My question is this:
How to allow a class to set one User in the UserManager() at any time (* ie * I would not provide a User default, but let another class create and setasse one User when necessary) ?
Remarks
- Interfaces have no properties lateinit
- I’d like the class
Userwere nonzero, so I didn’t wantnullis the default value foruser(i and. makingvar user: User? = null) - I would like to access the fields directly instead of using interface methods (i and. call userManager.user to return a user, rather than userManager.getUser() )