Singleton Pattern   «Prev  Next»

The Dual pattern - Exercise

Write a Class that uses the Dual Pattern.

  1. Write a class called Dual that has exactly two instances, instance1 and instance2.
  2. Provide an accessor method(s) that allows clients to retrieve both instances of the class.
  3. Do not allow clients direct access to the constructor.
In the text area below, type your answer and click the Submit button.