previous |
start |
next
Double Dispatch
- Each element type provides methods:
public class
ElementTypei
{
public void
accept(Visitor v) { v.visitElementTypei(this);
}
...
}
- Completely mechanical
- Example:
public class
DirectoryNode
{
public void
accept(Visitor v) { v.visitDirectoryNode(this); }
...
}
previous |
start |
next