Recently, reader feedback has led me to realize that I have left behind an important aspect of Scala's language while crafting this series: Scala's package and access modifier facilities.
最近,读者的反馈让我意识到在制作本系列的过程中我遗漏了Scala的语言的一个重要方面:Scala的包和访问修饰符功能。
Defines the access modifier of this item.
定义这个项目的存取修饰词。
Changing the access modifier for a class.
更改类的访问修饰符。
Changing the access modifier for a module.
更改模块的访问修饰符。
If no access modifier is specified in a member declaration, a default accessibility is used.
如果在成员声明中未指定访问修饰符,则使用默认的可访问性。
Note that if you do not use an access modifier with the constructor it will still be private by default.
注意,如果您不对构造函数使用访问修饰符,则在默认情况下它仍为私有构造函数。
You want to limit access to a method of a public class to member of the same class. Which access modifier accomlishes this objective?
如果想要让某个公共类的方法仅限于由同一个类的成员访问,该采用哪一个访问修饰字实现这一目的呢?
You want to limit access to a method of a public class to member of the same class. Which access modifier accomlishes this objective?
如果想要让某个公共类的方法仅限于由同一个类的成员访问,该采用哪一个访问修饰字实现这一目的呢?
应用推荐