创建一个私有方法,如下所示。
清单11展示了对类的私有方法的访问。
Listing 11 is an example of accessing a private method in a class.
源代码还提供了其他公共和私有方法以及类。
The source code also includes other public and private methods and classes.
是一个私有方法,如果当前用户已登录则返回true。
Is a private method returning true if the current user is logged in.
该代码使用私有方法从池中检索对象,并且调用所提供的委托。
This code USES the private methods to retrieve an object from the pool and call the provided delegate.
与属性一样,尝试从包含类外部调用私有方法将导致致命错误。
As with properties, any attempt to call a private method from outside the containing class causes a fatal error.
接着该密码文本字符串传递给getcipherdatadoc私有方法。
The cipher text string is then passed to the getCipherDataDoc private method.
特别是将一些私有方法变成公有方法能够使这个代码编写起来更容易。
In particular, being able to change a few private methods to public would have made this code a lot easier to write.
我还将解答其他某些棘手的TDD设计问题,例如是否测试及何时测试私有方法。
I'll also address some other sticky design questions about TDD, such as if and when to test private methods.
可以用私有方法setUIText()设置LogonUI上的所有文本。
You use the private method setUIText() to set all the text on the LogonUI.
有时候,这些代码是明显不可达的(未调用的私有方法以及未读入的本地变量,等等)。
Sometimes the code is very obviously unreachable (uncalled private methods, unread local variables, and so forth).
解决问题:不编制封闭实例,从类的私有方法是不可见的,这0美元是不能解决的。
Unresolved compilation problems: No enclosing instance, Private method from the class is not visible, this$0 cannot be resolved.
不应该使用实例构造函数、一些特殊的私有方法、任何其它习惯来初始化静态变量。
You should not use your instance constructors, some special private function, or any other idiom to initialize static variables.
如果它们已实现,从技术上讲,可以在noncopyable类自己的私有方法内复制该类!
Had they been implemented, it would have been technically possible to copy the noncopyable class within its own private methods!
NET框架,有,有成为外部可见的内部大量的诀窍,即使该代码生活里面的私有方法。
NET framework, there are plenty of internals that have a knack for becoming externally visible, even if that code lives inside private methods.
如果您认为Guice访问私有方法不是很好,可以参见清单10,其中FrogMan使用了字段注入。
If you think Guice's decision to access private methods seems intrusive, wait until you see Listing 10, in which FrogMan USES field injection.
populate方法现在短多了,看起来像是它需要执行的任务的大纲,任务的实现都放在私有方法中。
The populate method is much shorter now, and it reads like an outline of the tasks it needs to perform, with the task implementation residing in private methods.
实际情况是main()方法只是在一个实例化的AtomToRdf类上执行了一个私有方法 go()。
The reality is that the main() method simply executes a private method, go(), on an instantiated AtomToRdf class.
auth和list之间微妙但重要的一点区别是list是一个闭包,而auth是一个私有方法(闭包在定义中使用等号;方法使用圆括号)。
A subtle but important difference between auth and list is that list is a closure, whereas auth is a private method. (Closures use an equals sign in the definition; methods use parentheses.)
在NWS在线的情况下使用私有方法来从 NWS检索城市列表,在 NWS不在线的情况下从文件中检索城市列表,该方法把州和城市信息存在高速缓存中以提高性能。
The city list is retrieved from the NWS using a private method if the NWS is online and from a file if the NWS is not online, and the method caches state and city information to improve performance.
首先,我们要查找负责将特定源语言翻译为目标语言的 com.ibm.lt.LTinterface实现。 为此,我们将委托给一个名为 serviceLocator 的私有方法。
The first thing we do is look up the com.ibm.lt.LTinterface implementation responsible for translating a particular source language to a target language.
对于部署用于并行执行的应用程序,以私有方式部署的程序集是一种很方便的方法,因为这样的程序集不会影响计算机上的其他程序集。
Privately deployed assemblies are a convenient way to deploy an application for side-by-side execution because such assemblies cannot affect other assemblies on the computer.
对于部署用于并行执行的应用程序,以私有方式部署的程序集是一种很方便的方法,因为这样的程序集不会影响计算机上的其他程序集。
Privately deployed assemblies are a convenient way to deploy an application for side-by-side execution because such assemblies cannot affect other assemblies on the computer.
应用推荐