Scala case classes in depth

For this post I’ll consider the following simple case class unless otherwise specified: case class Person(lastname: String, firstname: String, birthYear: Int) Common knowledge about case classes When you declare a case class the Scala compiler does the following for you: Creates a class and its companion object. Implements the apply method that you can use as a factory. This lets you create instances of the class without the new keyword.