Created
June 11, 2011 09:15
-
-
Save xuwei-k/1020400 to your computer and use it in GitHub Desktop.
Scala で object と trait を同じ名前にする
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
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