Using the Singleton pattern examples found in this chapter, create a program to accomplish the following: 1.

Question:

Using the Singleton pattern examples found in this chapter, create a program to accomplish the following:

1. Implement either an interface for a President to Resign() or implement the interface to Impeach() a President. Your method should delete the current Singleton President (and remove that link from the SingletonDestroyer). SingletonDestroyer has a setSingleton() method that may be useful to aid in removing the backlink.

2. Noting that the former Singleton President has been removed, create a new President using President::instance(). Verify that the new President has been installed.

3. (Optional) Create a Registry to allow Singleton to be used effectively in multiple classes (not mutually exclusively, as is the current implementation).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer: