aishwaryabhishek3
06/25/2025, 6:35 AM// Sealed class without generics
sealed class Result
// Subclass with a generic type
data class Success<T>(val data: T) : Result()
// Subclass without a generic type
object Loading : Result()
Or
sealed class Result<T>
class Success<T>(val data: T) : Result<T>()
// Some other subclass that doesn't need T can be defined as
class Error(val message: String) : Result<Nothing>()