Hi StackOverflow!
I have this rather simple question about Scala. Given that i have to following class definition:
class Foo(var bar: Int)
The code which is able to construct an instance of Foo
must be able to pass the initial value for bar
. But if I define bar
as var
the User is also able to change its value at runtime which is not what I want. The User should only be able to read bar
. bar
itself is modified internally so a val
is not an option.
I think I might be getting an answer very soon as this question is so simple. :-)
Cheers, Malax