This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I think this is because the default is for the compiler to create private fields with no accessors so you do not have access to that.n but do have access to this.n (same as in Java when no getter is available), if you want to expose the data you need to declare some fields and assign n and d to them, the equivalent class in Java would be something like:
By default that parameters are treated somewhat like a "constructor parameters" but not "class fields". In some cases they may be not stored as fields (if they are used only in "constructor" code). And it is pretty convenient to access some "instance creation parameters" without manually putting them in some field.
However, your use case is also very common. So Scala have a special syntax to treat "constructor arguments" also as instance fields:
Such declarations are required for each parameter that need to be a field. "private" is not required, you may use any Scala access modifier there.
You may also use "case classes" in some cases. They always have it's "constructro arguments" as fields. But case classes are more specialized thing than general classes.