Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created June 11, 2011 09:15
Show Gist options
  • Save xuwei-k/1020400 to your computer and use it in GitHub Desktop.
Save xuwei-k/1020400 to your computer and use it in GitHub Desktop.
Scala で object と trait を同じ名前にする
Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
Type in expressions to have them evaluated.
Type :help for more information.
scala> object A{
| trait B{
| override def toString = "trait"
| }
|
| object B{
| override def toString = "object"
| }
|
| }
defined module A
scala> A.B
res0: A.B.type = object
scala> new A.B{}
res1: java.lang.Object with A.B = trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment