Why it is possible to create instance of a case class in scala without new operator?
            Asked
            
        
        
            Active
            
        
            Viewed 210 times
        
    1 Answers
2
            Try this.
class C(arg: Int)
object C {
  def apply(i: Int): C = new C(i)
}
val c = C(99)
A case class automatically creates the companion object with the factory method via apply().
        jwvh
        
- 50,871
 - 7
 - 38
 - 64