March 2002
Intermediate to advanced
496 pages
8h 51m
English
| SOLUTION 8.1 | To prevent other developers from instantiating your class, create a single constructor with private visibility. Note that if you create other, nonprivate constructors or create no constructors at all, other developers will likely be able to reinstantiate your class. |
| SOLUTION 8.2 | As Design Patterns says, “You might not have enough information to instantiate every singleton at static initialization time. A singleton might require values that are computed later in the program's execution” (p. 130). When a Factory singleton is born, for example, it might have to establish connections with machine drivers, to set up planners, and to initialize a simulation of itself. |
| SOLUTION 8.3 | Your solution should eliminate the possibility ... |
Read now
Unlock full access