Access Modifiers in
Scala
Access Modifiers in scala
are used to define the access field of members of packages, classes or objects
in scala. For using an access modifier, you must include its keyword in the
definition of members of package, class or object.These modifiers will restrict
accesses to the members to specific regions of code.
There are Three types of access modifiers available in Scala:
There are Three types of access modifiers available in Scala:
1.
Private
2.
Protected
3.
Public
Table:
|
MODIFIER
|
CLASS
|
COMPANION
|
SUBCLASS
|
|
No Modifier/Public
|
Yes
|
Yes
|
Yes
|
|
Protected
|
Yes
|
Yes
|
Yes
|
|
Private
|
Yes
|
Yes
|
No
|
No comments:
Post a Comment