Access from anywhere to public components of the class.
从任意位置到类公共组件的接入。
It's reasonable to follow common object-oriented programming practices and have getters and setters in the public interface, but within a class you should always access fields directly.
通常根据面向对象语言的实践,在公共接口中使用Getters和Setters是有道理的,但在一个字段经常被访问的类中宜采用直接访问。
Because clone has protected access in Object and, to call clone , you have to call it through a reference to a class that has overridden clone to be public.
因为clone在Object中是保护访问的,调用clone必须通过将clone改写公共访问的类引用来完成。
In other words, it's the class in the Web service code with public methods that users can access.
换句话说,它就是Web服务代码中带有用户可访问的public方法的类。
A well-designed CherryPy class will probably have only a few public methods exposed to Web clients, but it may have many internal methods a client shouldn't be allowed to access directly.
一个设计良好的CherryPy类可能只有少数几个公有的方法暴露给Web客户机,但是它很可能有许多不允许客户机直接访问的内部方法。
Only when an external class or object needs to access an attribute should you make the appropriate getter or setter public.
只有当外部的类或对象需要访问其属性时,才使相应的getter或setter公有。
That's why the Vehicle class, and its subclasses, have either private or protected fields, and public setter and getter methods to provide access.
这也正是Vehicle类及其子类都具有 private或者protected属性,而用publicsetter和getter方法来访问属性的原因。
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 following example shows how to help protect a public class for limited access by requiring that callers be signed with a particular strong name.
以下范例显示如何要求以特定强式名称签名呼叫端,以协助保护公用类别受到限制存取。
The following example shows how to help protect a public class for limited access by requiring that callers be signed with a particular strong name.
以下范例显示如何要求以特定强式名称签名呼叫端,以协助保护公用类别受到限制存取。
应用推荐