I have an interface called UserManager
interface UserManager {
var user:User
}
and a class called UserManagerImplthat implementsUserManager
class UserManagerImpl : UserManager {
override var user: User
}
Here is my problem:
How to allow another class to be set Userto UserManager()at any time (i.e., not to provide an initial object Usernext to the property declaration and allow another class to create and provide an instance User)?
Keep in mind that
- Interfaces cannot have lateinit properties .
- I want it to
Userbe a non-empty value, so the nullable ( User?) property - I want to use access to the field instead of ads and use the method
setUser(User)and getUser()interface