Scala case class private constructor but public apply method
If I have the following case class with a private constructor and I can not access the apply-method in the companion object. case class Meter private (m: Int) val m = Meter(10) // constructor Meter in class Meter cannot be accessed... Is there a way to use a case class with a private constructor but keep the generated apply-method in the companion public? I am aware that there is no difference (in my example) between the two options: val m1 = new Meter(10) val m2 = Meter(10) but I want to forbid the first option. -- edit -- Surprisingly the following works (but is not really what i want): val