Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#odersky-programming-in-scala-2ed #scala
Question

class Outer {
 class Inner {
  private def f() { println("f") }
  class InnerMost {
   f()
  }
 }
 (new Inner).f() // is it legal in Scala? why? woudl it be legal in Java?
}
Answer
access (new Inner).f() is illegal because f is declared private in Inner and the access is not from within class Inner - in Java it would be legal

Tags
#odersky-programming-in-scala-2ed #scala
Question

class Outer {
 class Inner {
  private def f() { println("f") }
  class InnerMost {
   f()
  }
 }
 (new Inner).f() // is it legal in Scala? why? woudl it be legal in Java?
}
Answer
?

Tags
#odersky-programming-in-scala-2ed #scala
Question

class Outer {
 class Inner {
  private def f() { println("f") }
  class InnerMost {
   f()
  }
 }
 (new Inner).f() // is it legal in Scala? why? woudl it be legal in Java?
}
Answer
access (new Inner).f() is illegal because f is declared private in Inner and the access is not from within class Inner - in Java it would be legal
If you want to change selection, open document below and click on "Move attachment"

pdf

cannot see any pdfs

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.