Friday, March 13, 2009

Describe the visitor design pattern (General)

Question :Describe the visitor design pattern (General)
Answer :Represents an operation to be performed on the elements of an object
structure. Visitor lets you define a new operation without changing the
classes of the elements on which it operates.
The root of a class hierarchy defines an abstract method to accept a
visitor. Subclasses implement this method with visitor.visit(this). The
Visitor interface has visit methods for all subclasses of the baseclass in the
hierarchy.

No comments: