GofPattern
SiteMap
Design Patterns Course
Behavioral Patterns
Creational Patterns
Structural Patterns
Singleton Pattern
«Prev
Next»
Design Patterns
Defining Patterns
Design Challenges
Pattern Concept
Design Pattern Components
Big-O Notation
Design Pattern Benefits
Three Types Design Patterns
Three Categories Patterns
Design Pattern Scope
Traffic Signals Project
Patterns Conclusion
Singleton Patterns
Design Pattern Elements
Intent Motivation
Pattern Applicability
Singleton Pattern Structure
Singleton Structure
Singleton Pattern-Quiz
Participants Collaborations
Consequences Effects
Class Implementation
Real World Examples
Substitute Patterns
Extension Variation Pattern
Course Project
Perfect Singleton
Pattern Conclusion
Creational Patterns
Creational Design Pattern
Creational Pattern Uses
Common Creational Patterns
Factory Pattern
Factory Method-Exercise
Factory Method Structure
Factory Method Consequences
factory Pattern Summary
Structural Patterns
Structural Pattern Example
Patterns Help Programmers
Common Structural Patterns
Flyweight Pattern
Flyweight Consequences
Flyweight Suitability
Behavioral Patterns
Define Behavioral Patterns
Mediator Pattern Applicability
Observer Pattern Tradeoffs
Designing Software
How to Choose Pattern
How To Apply Pattern
Lessons Learned
Combine Design Patterns
Design Pattern Limitations
Traffic flow System
Course Conclusion
The Dual pattern - Exercise
Write a Class that uses the Dual Pattern.
Write a class called
Dual
that has exactly two instances,
instance1
and
instance2
.
Provide an accessor method(s) that allows clients to retrieve both instances of the class.
Do not allow clients direct access to the constructor.
In the text area below, type your answer and click the
Submit
button.