Skip to Content
Visual Basic Design Patterns: VB 6.0 and VB.NET
book

Visual Basic Design Patterns: VB 6.0 and VB.NET

by James W. Cooper
November 2001
Intermediate to advanced
512 pages
9h 10m
English
Addison-Wesley Professional
Content preview from Visual Basic Design Patterns: VB 6.0 and VB.NET

Chapter 32. The Visitor Pattern

The Visitor pattern turns the tables on our object-oriented model and creates an external class to act on data in other classes. This is useful when you have a polymorphic operation that cannot reside in the class hierarchy for some reason—for example, because the operation wasn't considered when the hierarchy was designed or it would clutter the interface of the classes unnecessarily. The Visitor pattern is easier to explain using VB7, since polymorphism and inheritance make the code rather simpler. We'll discuss how to implement the Visitor in VB6 at the end of this chapter.

Motivation

While at first it may seem “unclean” to put operations inside one class that should be in another, there are good reasons for doing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Visual Basic 2008

Programming Visual Basic 2008

Tim Patrick
Visual Basic 2015 Unleashed

Visual Basic 2015 Unleashed

Alessandro Del Sole

Publisher Resources

ISBN: 0201702657Purchase book