I guess I'm wondering if there's a more "common" (...
# arrow
d
I guess I'm wondering if there's a more "common" (or existing) way of doing the following:
Copy code
sealed class Cargo<T> {
  class Loading<T> : Cargo<T>()
  data class Loaded<T>(val cargo: T) : Cargo<T>()
  data class Error<T>(val cargo: T) : Cargo<T>()
}
p
loading can be an
object
there, as you don't need instances
s
And it can be of type
Cargo<Nothing>
. 🙂 (then be sure to declare T as covariant:
<out T>
)
🔝 2