One of the great things about object-oriented programming is the ability to reuse code by creating multiple instances of a class. When we make changes to a class, all instances will inherit those changes, so we only have to make the change once.
- We need to understand the Registry design pattern and the problems it helps us to overcome.
- We then need to build a
Registryclass to store object instances. This is an essential part of an efficient framework, so it will be our only focus in this chapter.
There will, however, be times when we expect to only use one instance of a given class. We can achieve this ...