Is it possible to do that in Scala using only val:
class MyClass { private val myVal1: MyClass2 //.....????? what should be here? def myMethod1(param1: Int)
No, it isn't possible to do in the way you want. Consider, what would be the result of
val mc = new MyClass mc.method1(0) mc.method1(1)
? An exception thrown for setting myVal1 twice? Or should it keep the first value?
myVal1