Hey guys, is it possible to extend a data class wi...
# announcements
k
Hey guys, is it possible to extend a data class with an abstract class? My use case is as follows, I have a CommonResponse Params abstract class
Copy code
abstract class CommonResponseParams (
    val type: String,
    val code: String,
    val message: String,
    @SerializedName("request_id")
    val requestId: String,
    val detail: CommonDetailsResponseObject?
)
And I have a more specific Response Params which has the Common Params on top of it I wish to extend this data class with the abstract class above
Copy code
data class GetCategoryAttributeResponse (
    val commonDetails : CommonDetailsResponseObject,
    @SerializedName("data")
    val getCategoryData: CategoryAttributeResponseData
)
d
No, it is not possible. A data class can implement interfaces though.