Created
September 27, 2014 07:51
-
-
Save aoiroaoino/ddc3d7dc901f3cef95ed to your computer and use it in GitHub Desktop.
This file contains 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 User { | |
val name: String | |
} | |
trait Password { | |
val key: Option[String] | |
} | |
//------------------------------- | |
trait NoPassword extends Password { | |
val key = None | |
} | |
//------------------------------- | |
trait PublicUser { | |
self: User with Password => | |
} | |
trait PrivateUser extends NoPassword { | |
self: User with Password => | |
} | |
//------------------------------- | |
val publicUser = new PublicUser with User with Password { | |
val name = "Hoge" | |
val key = Some("aaa") | |
} | |
val privateUser = new PrivateUser with User with NoPassword { | |
val name = "Huga" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment