scalacheat
scalacheat copied to clipboard
class C(x: R) not the same as class C(private val x: R)
scala> class C(private val x: Int) { def add(c: C) = x + c.x }
defined class C
scala> class C(x: Int) { def add(c: C) = x + c.x }
error: type mismatch;
found : c.type (with underlying type C)
required: ?{val x: ?}
I agree they are similar in other cases though. :-)