Guest User

Untitled

a guest
Jan 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. Welcome to Scala version 2.9.0.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
  3. Type in expressions to have them evaluated.
  4. Type :help for more information.
  5.  
  6. scala> trait scope {
  7. | class A extends AnyRef with Z {
  8. | def aaa() = zzz2()
  9. | def aaa2() = 100
  10. | }
  11. | trait Z {self: A =>
  12. | def zzz() = aaa2()
  13. | def zzz2() = 22
  14. | }
  15. | }
  16. defined trait scope
  17.  
  18. scala> object M extends scope {
  19. | def main(args: Array[String]) {
  20. | val a = new A
  21. | println(a.aaa() + a.zzz())
  22. | }
  23. | }
  24. defined module M
  25.  
  26. scala> M.main(Array())
  27. 122
Add Comment
Please, Sign In to add comment