Access Specifier in Scala
Access Specifier
In Scala, there are mainly three types of Access Specifier:
1. Public: It is the default access modifier. When the keywords private or protected are not specified, the members are treated as public by the compiler and we don’t have to explicitly specify the keyword “public“.
2. Private: These specifiers are available only inside the class or to the object containing the member definition. The private access modifier can be used for variables and methods as well.
3. Protected: It can be accessed from sub-classes of the class in which the member is defined. This can also be used for methods as well as variables.