title: Extend trait with private constructor parameter
body: <p>In Scala, how can I extend a trait in a class with <strong>private</strong> constructor parameter that is defined in the trait? </p>
  
  <pre><code>trait Parent {
    protected def name: String
    require(name != "", "wooo problem!")
  }
  
  class Child(private val name: String) extends Parent {
    println("name is " + name)
  }
  </code></pre>
  
  <p>The above class gives an error: </p>
  
  <blockquote>
    <p>class Child needs to be abstract, since method name in trait Parent of type ⇒ String is not defined.</p>
  </blockquote>
  
  <p>Of-course I can:</p>
  
  <ol>
  <li>make the <code>Child</code> class abstract, </li>
  <li>define it without using the private in the constructor like <code>class Child(val name: String)</code>. </li>
  <li>make the Parent an <code>abstract class</code> instead of a trait</li>
  </ol>
  
  <p>But with the above implementation, is there no way I can have a <strong>private</strong> constructor parameter while extending a trait? Note that I want the variable to be private so that I should not be able to do <code>childInstance.name</code>.</p>