title: Case Class default apply method
body: <p>Assuming we have the following case class:</p>
  
  <pre><code>case class CasePerson(firstName: String)
  </code></pre>
  
  <p>And we also define a companion object for it:</p>
  
  <pre><code>object CasePerson {
   def apply() = new CasePerson( "XYZ" )
  }
  </code></pre>
  
  <p>Notice that in the example above I explicitly defined a companion object with an <code>apply</code> method, without defining the the default apply method:</p>
  
  <pre><code>// This "default" apply has the same argument as the primary constructor of the case class
  def apply(firstName : String) = new CasePerson(firstName)
  </code></pre>
  
  <p><strong>Q:</strong> So where does Scala gets this "default" apply? I explicitly defined the companion object here without the default apply and the compiler still knows how to execute this:</p>
  
  <pre><code>val casePerson = CasePerson("PQR")
  </code></pre>
  
  <p>How does this work?</p>