Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Visitor Design Pattern. What’s It All About? Allows for new operations to be defined and used on elements of an object structure with out changing.

Similar presentations


Presentation on theme: "The Visitor Design Pattern. What’s It All About? Allows for new operations to be defined and used on elements of an object structure with out changing."— Presentation transcript:

1 The Visitor Design Pattern

2 What’s It All About? Allows for new operations to be defined and used on elements of an object structure with out changing the contents of those elements. The Key is Double Dispatch

3 Where Applicable Rarely Changing Object Structures Using Unrelated Operations Many Classes with Differing Interfaces

4 How it Works Concrete Object Structure Assume Rarely Changing Bank Accounts

5 Add an Inquiry Operation Inquiry to Display Accounts Don’t Want to Change Structure Create a Visitor Structure Account Visitor

6 Account Visitor Interface

7 Inquiry Visitor

8 Account Structure Change

9 Account Interface

10 Checking Account

11 Savings Account

12 Main Method


Download ppt "The Visitor Design Pattern. What’s It All About? Allows for new operations to be defined and used on elements of an object structure with out changing."

Similar presentations


Ads by Google