# Data class inheritance

**URL:** <https://discuss.kotlinlang.org/t/data-class-inheritance/2454>\
**Category:** Android\
**Created:** [March 31, 2017, 9:05am UTC](https://discuss.kotlinlang.org/t/data-class-inheritance/2454 "2017-03-31T09:05:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![charyyevarslan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/charyyevarslan/32/2428_2.png) [@charyyevarslan](https://discuss.kotlinlang.org/u/charyyevarslan)\
**Post date:** [March 31, 2017, 9:05am UTC](https://discuss.kotlinlang.org/t/data-class-inheritance/2454/1 "2017-03-31T09:05:17Z")

</div>

Let’s say I have an independent java module (library) which is used to generate sets of data classes (like Course, Exam, Teacher). Then when I want to use the library in Android I would like to extend these data classes and add some Android specific features, like implementing Parcelable, adding new properties (e.g. id for DB, etc.) and new constructors. I did this in Java, but since inheritance of data classes is not supported in Kotlin, the only workaround I see is to create a new data class in Android module which would have exactly the same properties and functions + new ones. I would also add a constructor which takes “base” data class. So I wonder: Is this a good design? Why or why not? Are there any alternative approaches?
