To design a singleton class, we may take into account
Para diseñar una clase singleton, hemos de tener en cuenta lo siguiente
The most used code pattern to create a singleton class is something like this
El patrón de código habitual para generar una clase singleton sería algo parecido a esto
Ok... let's see how we can apply this to our singleton class from our first example: Joining efforts
Bien... vamos a ver como podemos aplicar esto a la clase singleton que hemos visto antes...
This way, when calling from another class to the method getInstance of the class ClaseSingleton, you get the same instance every time, this way variables and methods that have a singleton class can be reused from other classes.
De esta manera, al llamar desde otra clase al método getInstance de la clase ClaseSingleton, se obtiene la misma instancia cada vez, de esta manera las variables y métodos que pueda tener una clase singleton podemos reutilizarlas desde otras clases.
Fixed: Prevent double instance in singleton class
Corrección: Prevenir doble instancia en clase singleton
The GameService class, in Listing 10, is a singleton class that represents the game server and the current state of the given game.
La clase GameService, en el Listado 10, es una clase singleton que representa el servidor del juego y el estado actual del juego dado.
In the following example, we create a Singleton class to define the set up parameters of an application.
En este ejemplo se creará una clase Singleton para definir las configuraciones de una aplicación.
Because the Singleton class encapsulates its sole instance, it can have strict control over how and when clients access it.
Dado que la clase Singleton encapsula su única instancia, ella tiene estricto control de acceso sobre como y cuando acceden los clientes a dicha instancia.
Even if I disable the caching in the singleton class, I'm running out of memory.
Incluso si imposibilito el *caching en el *singleton clase, estoy corriendo fuera de memoria.
The singleton class holds the method and constant tables that belong only to a particular object instance.
La singleton clase tiene las tablas de métodos y constantes que preñen a una instancia (objeto) en particular.
For example, the method +hello+ defined below exists only in the singleton class for +obj+.
Por ejemplo, el método +hello+ definido a continuación existe solamente en la singleton clase de +obj+.
The rule is simple: Take the object located in the class slot of the object (which is not always the return value of Object#class; if the object has one, it'll be the singleton class) and begin searching.
La regla para la resolución de métodos es sencilla: Se toma el objeto que se encuentra en la posición class del objeto (que no siempre es igual a Object#class) y se comienza la búsqueda del método.
Conținut posibil inadecvat
Exemplele au rolul de a te ajuta să traduci cuvinte sau expresii corect si adaptat la context. Nu sunt selectate sau validate manual, așadar pot conține termeni inadecvați. Te rugăm să raportezi exemplele pe care le consideri inadecvate. Traducerile vulgare sau colocviale sunt în general marcate cu roșu sau cu portocaliu.
Nici un rezultat pentru acest sens.
Sinonime și analogii pentru "singleton class" în limba Română