Last active
January 31, 2016 06:46
-
-
Save erangaeb/89b6a9675b5cf87dc28c to your computer and use it in GitHub Desktop.
Inheritance leaks and breaks encapsulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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