title: overloading unapply method in case classes: scala
body: <p>Consider the following piece of code:</p>
  
  <pre><code>case class User(id: Int, name: String)
  object User{
    def unapply(str: String) = Some(User(0, str))
  }
  </code></pre>
  
  <p>Scala complains "error: cannot resolve overloaded unapply; case class User(id: Int, str: String)"
  Is it not possible to overload unapply? </p>
  
  <p>update: 
      unapply with larger tuple size.</p>
  
  <pre><code>case class User(id: Int, str: String)
  object User{
    def unapply(s: String) = Some((User(0, s), s, 1234))
  }
  </code></pre>
  
  <p>compiler still complains "cannot resolve overloaded unapply"</p>