title: How to inherit class in scala
body: <p>I am trying to inherit a class in Scala. My Parent class is </p>
  
  <pre><code>case class Person (name:String, age:Int, valid:Boolean)
  </code></pre>
  
  <p>My child class is </p>
  
  <pre><code>case class MarriedPerson (override val name: String,
    override val age: Int,
    override val valid: Boolean,
    spouse: Person) extends Person(name, age, valid)
  </code></pre>
  
  <p>When I try this, I get an error saying </p>
  
  <blockquote>
    <p>:13: error: case class MarriedPerson has case ancestor Person, but case-to-case inheritance is prohibited. To overcome this limitation, use extractors to pattern match on non-leaf nodes.</p>
  </blockquote>
  
  <ol>
  <li>Why is this the case and how I get around this to get a <code>case class</code> to inherit another <code>case class</code>?</li>
  <li><p>If I remove the "case" in the parent class, I get an error saying
  that</p>
  
  <blockquote>
    <p>:15: error: value name overrides nothing
       override val name: String,</p>
  </blockquote></li>
  </ol>
  
  <p>Why can't a <code>case class</code> not inherit from a normal class in this case?</p>