Skip to content

Instantly share code, notes, and snippets.

@erangaeb
Last active January 31, 2016 06:46
Show Gist options
  • Save erangaeb/89b6a9675b5cf87dc28c to your computer and use it in GitHub Desktop.
Save erangaeb/89b6a9675b5cf87dc28c to your computer and use it in GitHub Desktop.
Inheritance leaks and breaks encapsulation
trait Lambda {
val l = "Lambda"
}
trait Calculus extends Lambda {
val c = "Calculus"
val lc = l + c
}
trait Turing extends Calculus {
val t = "Turing"
val lct = l + c + t // no compilation error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment