I need to use full class's interface of a field in...
# announcements
v
I need to use full class's interface of a field inside a class, but expose an interface outside. Currently I do this:
Copy code
class Actor() {
    private val addCh = Channel<Long>()
    private val getAndResetCh = Channel<SendChannel<Long>>()

    // expose `SendChannel`s because client code should not be able to receive our messages.
    val add = addCh as SendChannel<Long>
    val getAndReset = getAndResetCh as SendChannel<SendChannel<Long>>
    ....
}
Is there a way to simplify it? Like some magic with properties I don't know about yet?