https://kotlinlang.org logo
Title
a

Andreas Sinz

12/14/2017, 8:13 AM
all you want is
FooEvent
to be a
data class
and have an empty constructor?
y

ylemoigne

12/14/2017, 8:26 AM
Yes...
l

lovis

12/14/2017, 8:51 AM
...but why do you want a data class without data? 🤔
y

ylemoigne

12/14/2017, 8:53 AM
Because there is data (inherited)
l

lovis

12/14/2017, 8:54 AM
ah ok, sorry should've read the 😒tackoverflow: question 😅
y

ylemoigne

12/14/2017, 8:55 AM
lol, it's ok.
a

Andreas Sinz

12/14/2017, 8:55 AM
@ylemoigne the inherited data is NOT used for `copy`/`componentN`/`equals`
💡 2
only properties inside the primary constructor of the data class
so overriding inside
FooEvent
is your best bet
y

ylemoigne

12/14/2017, 8:57 AM
Ho ! I Missed that....
Thanks. Is there a doc explaining how inheritance of data class works ?
Ok, well thanks again.
a

Andreas Sinz

12/14/2017, 9:02 AM
The documentation contains the sentence "The compiler automatically derives the following members from all properties declared in the primary constructor:"