The scope of Scala permission modifier

  • public : The default permission in scala, all classes can access. But it cannot be declared explicitly .
  • private : Only this class and companion objects can access.
  • protect : Only this class and subclasses can be accessed, and other classes in the same package cannot be accessed.
  • private[package name] : Other classes under the specified package can also be accessed.

Guess you like

Origin blog.csdn.net/FlatTiger/article/details/114441335