You want to limit access to a method of a public class to member of the same class. Which access modifier accomlishes this objective?
如果想要让某个公共类的方法仅限于由同一个类的成员访问,该采用哪一个访问修饰字实现这一目的呢?
The Modifier class provides static methods and constants to decode class and member access modifiers.
Modifier类提供了静态方法和常量来对类和成员访问修饰符进行编码。
Theprotected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.
只有在通过派生类类型发生访问时,基类的受保护成员在派生类中才是可访问的。
Theprotected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.
只有在通过派生类类型发生访问时,基类的受保护成员在派生类中才是可访问的。
应用推荐