• 他们会发现每次他们要创建一个不同的单例类的时候,都不得不写同样得代码。

    Those who use it will find that they often have to write the same code each time they want to create a different Singleton class.

    youdao

  • 当单例类的副本运行于多个虚拟机中时,每个虚拟机都会为其创建一个实例对象。

    When copies of the singleton class run in multiple VMs, an instance is created for each machine.

    youdao

  • 清单10中的gameservice类是一个单例类,代表给定游戏的游戏服务器和当前状态。

    The GameService class, in Listing 10, is a singleton class that represents the game server and the current state of the given game.

    youdao

  • 最后,在单例模式的一些实现方式中,单例类的子类能够动态地重载方法,这是静态方法所不能办到的。

    With some implementations of the singleton, you allow writers of subclasses to override methods polymorphically, something not possible with static methods.

    youdao

  • 这样分离出单例结构的代码,将有利于保持按单例模式使用类或不按单例模式使用类的灵活性。

    This has the added benefit of separating singleton code from the class code leaving the flexibility to use several instances of the class or using the class as a singleton.

    youdao

  • 单例模式可能是最常用的OOP设计模式之一了;它限制了一个类的对象实例数只能为1。

    The singleton pattern is probably one of the most often used OOP design patterns; it restricts the number of object instances of a class to one.

    youdao

  • 单例:保证一个类仅有一个实例,并提供一个访问它的全局访问点。

    Singleton: one instance of a class or one value accessible globally in an application.

    youdao

  • 单例模式:确保一个类只有一个实例,并提供一个全局访问点。

    The Singleton Pattern:ensures a class has only on instance, and provides a global point of access to it.

    youdao

  • 由于单例对象作为实例存在而不是类的静态成员,所以你能够惰性地初始化单例对象,即只需要在第一次用它的时候才去创建它。

    With singletons implemented as single instances instead of static class members, you can initialize the singleton lazily, creating it only when it is first used.

    youdao

  • 比如数据库连接池就是单例设计模式的一个例子:我们一般不想让应用程序具有连接池类的多个资源密集型实例。

    An example use case for a singleton would be a database connection pool: you don't want your application to have multiple resource-intensive instances of a connection pool class.

    youdao

  • 单例模式是一种有用的控制类访问的途径,他能保证只有一个类实例存在。

    Singletons are a useful way to control access to a class, making sure that only one instance can exist.

    youdao

  • 清单4显示了使用方法而非属性来指定适当类的单例。

    Listing 4 shows a version of the singleton that USES a method instead of an attribute to specify the appropriate class.

    youdao

  • 尽管单例实现使用的是子类的类名,其他的模式(比如稍后介绍的活动记录模式)需要引用其他的静态属性。

    Whereas the singleton implementation uses the subclass's class name, other patterns (such as active record, covered later) need to reference other static properties.

    youdao

  • 使用类来实现单例模式可以确保在任何时间只有一个实例对象。

    Classes implementing Singleton pattern will ensure that only one instance of the object ever exists at any one time.

    youdao

  • 多个单例对象被不同的类加载器同时加载。

    Multiple singletons simultaneously loaded by different class loaders.

    youdao

  • 单例模式确实能够轻而易举解决无须对每个类的引用都进行存储的问题。

    They easily solve the problem of not having to store references to every class.

    youdao

  • 这是一个Scala单例(singleton),因为它使用对象声明,而不是类声明。

    This is a Scala singleton because it USES the object declaration instead of a class declaration.

    youdao

  • 单例模式是一种非常有用的设计模式,它允许你的类对外只提供一个实例,但是常犯的错误在于不止一个实例被创建。

    The singleton is a useful design pattern for allowing only one instance of your class, but common mistakes can inadvertently allow more than one instance to be created.

    youdao

  • 此类提供了一组类或一组单例(singleton)对象实例,在一个JAX-RS应用程序内包括所有的根级别的资源和提供程序(由 @Provider注释的类)。

    This class provides a set of classes, or a set of singleton object instances, that include all of the root-level resources and providers (classes annotated with @Provider) in a JAX-RS application.

    youdao

  • Ext名称空间全局对象封装了Sencha类库提供的所有的类,单例对象,实用方法。

    The Ext namespace (global object) encapsulates all classes, singletons, and utility methods provided by Sencha's libraries.

    youdao

  • 什么时候使用带有静态成员的类,什么时候使用单例?

    When would you use a class with static members and when would you use a Singleton class?

    youdao

  • 使用这个类,不需要复制代码就可以实现任意类单例化。

    So with this class we can makeany class singleton, without duplicating the code.

    youdao

  • 使用这个类,不需要复制代码就可以实现任意类单例化。

    So with this class we can makeany class singleton, without duplicating the code.

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定