title: Equality in Kotlin
body: <p>I'm learning Kotlin, with a C++ and Java background. I was expecting the following to print <code>true</code>, not <code>false</code>. I know that <code>==</code> maps to <code>equals</code>. Does the default implementation of <code>equals</code> not compare each member, i.e. <code>firstName</code> and <code>lastName</code>? If so, wouldn't it see the string values as equal (since <code>==</code> maps to <code>equals</code> again)? Apparently there's something related to equality versus identity that I haven't got right in Kotlin yet.</p>
  <pre><code>class MyPerson(val firstName: String, val lastName: String)
  
  fun main(args: Array&lt;String&gt;) {
     println(MyPerson(&quot;Charlie&quot;, &quot;Parker&quot;) == MyPerson(&quot;Charlie&quot;, &quot;Parker&quot;))
  }
  </code></pre>