title: Extend data class in Kotlin
body: <p>Data classes seem to be the replacement to the old-fashioned POJOs in Java. It is quite expectable that these classes would allow for inheritance, but I can see no convenient way to extend a data class. What I need is something like this:</p>
  
  <pre><code>open data class Resource (var id: Long = 0, var location: String = "")
  data class Book (var isbn: String) : Resource()
  </code></pre>
  
  <p>The code above fails because of clash of <code>component1()</code> methods. Leaving <code>data</code> annotation in only one of classes does not do the work, too.</p>
  
  <p>Perhaps there is another idiom to extend data classes?</p>
  
  <p>UPD: I might annotate only child child class, but <code>data</code> annotation only handles properties declared in the constructor. That is, I would have to declare all parent's properties <code>open</code> and override them, which is ugly:</p>
  
  <pre><code>open class Resource (open var id: Long = 0, open var location: String = "")
  data class Book (
      override var id: Long = 0,
      override var location: String = "",
      var isbn: String
  ) : Resource()
  </code></pre>