| <<< Visitor Structure | Index | Visitor Sample >>> |
Visitor does not have Iterator-specific restrictions.
Visitor can visit objects that don't have a common parent class.
Any type of object can be added to Visitor's interface:
class Visitor {
public:
void visit( TypeOne* );
void visit( TypeTwo* );
};
where TypeOne and TypeTwo do not have to be related through inheritance at all.
Visitors make adding new operations easy: add another visitor and define its visit() operation accordingly.
| <<< Visitor Structure | Index | Visitor Sample >>> |