Skip to content

Instantly share code, notes, and snippets.

@andrewharmellaw
Created May 17, 2013 20:17
Show Gist options
  • Save andrewharmellaw/5601722 to your computer and use it in GitHub Desktop.
Save andrewharmellaw/5601722 to your computer and use it in GitHub Desktop.
Scala class with private (and immutable) parameter
val aClass = new ClassWithPrivateFields("name")
// NOTE: aClass.name is not accessible
// Which is equivalent to the following in Java:
//
// public class ClassWithValParameter() {
//
// private String description;
//
// public ClassWithVarParameter(String description) {
// this.description = description;
// }
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment