‹ BACK

Access modifiers

Access modifiers can be augmented with qualifiers. A modifier of the form private[X] or protected[X] means that access is private or protected "up to" X, where X designates some enclosing package, class or singleton object.
package quizful {
   package prof {
      class Executive {
         private[prof] var details = null
         private[quizful] var friends = null
         private[this] var secrets = null

         def help(another : Executive) {
            println(another.details)
            println(another.secrets) //ERROR
         }
      }
   }
}
Note the following points:
access modifiers qualifiers

To check your knowledge the following tests are recommended:
Check your scala scala skills.